Update examples.
This commit is contained in:
1 parent
f388ed6808
commit
db7af704a6
39 files changed
+278
-169
No files matched your search
@@ -19,7 +19,10 @@ int intcmp(int a, int b)
|
||||
}
|
||||
|
||||
// Creates a treemap of integers
|
||||
TREEMAP_GENERATE(tm, treemap, /* FMOD */, int, double)
|
||||
CMC_GENERATE_TREEMAP(tm, treemap, int, double);
|
||||
typedef struct treemap treemap;
|
||||
typedef struct treemap_iter treemap_iter;
|
||||
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
@@ -211,7 +214,7 @@ int main(int argc, char const *argv[])
|
||||
// Dispose the iterator called by tm_iter_new()
|
||||
tm_iter_free(iter);
|
||||
// Dispose the treemap created
|
||||
tm_free(my_map);
|
||||
tm_free(my_map, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -17,7 +17,11 @@
|
||||
// Mapping an integer by size_t which will represent the key's multiplicity
|
||||
// (key could be anything and multiplicity could be an integer, preferably
|
||||
// unsigned)
|
||||
TREEMAP_GENERATE(tm, tmap, , int, size_t)
|
||||
CMC_GENERATE_TREEMAP(tm, tmap, int, size_t);
|
||||
typedef struct tmap tmap;
|
||||
typedef struct tmap_iter tmap_iter;
|
||||
typedef struct tmap_node tmap_node;
|
||||
|
||||
|
||||
// Compare function used by the treemap
|
||||
int intcmp(int a, int b)
|
||||
@@ -80,7 +84,7 @@ int main(int argc, char const *argv[])
|
||||
printf("Map[%2d] = %" PRIuMAX "\n", tm_iter_key(&it), tm_iter_value(&it));
|
||||
}
|
||||
|
||||
tm_free(map);
|
||||
tm_free(map, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user