Update examples.

This commit is contained in:
TryExceptElse committed 2019-11-22 00:11:01 -08:00
1 parent f388ed6808
commit db7af704a6
39 files changed
+278 -169

No files matched your search

+5 -2
View File
@@ -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;
}
+6 -2
View File
@@ -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;
}