Update examples.
This commit is contained in:
1 parent
f388ed6808
commit
db7af704a6
39 files changed
+278
-169
No files matched your search
@@ -32,7 +32,10 @@ int intcmp(int a, int b)
|
||||
}
|
||||
|
||||
// Creates a treeset of integers
|
||||
TREESET_GENERATE(ts, treeset, /* FMOD */, int)
|
||||
CMC_GENERATE_TREESET(ts, treeset, int);
|
||||
typedef struct treeset treeset;
|
||||
typedef struct treeset_iter treeset_iter;
|
||||
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
@@ -188,7 +191,7 @@ int main(int argc, char const *argv[])
|
||||
// Dispose the iterator called by ts_iter_new()
|
||||
ts_iter_free(iter);
|
||||
// Dispose the treeset created
|
||||
ts_free(my_treeset);
|
||||
ts_free(my_treeset, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -18,7 +18,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
TREESET_GENERATE(set, set, /* static */, int)
|
||||
CMC_GENERATE_TREESET(set, set, int);
|
||||
typedef struct set set;
|
||||
typedef struct set_iter set_iter;
|
||||
|
||||
|
||||
void print_set(set *s)
|
||||
{
|
||||
@@ -92,12 +95,12 @@ int main(int argc, char const *argv[])
|
||||
printf("=\n");
|
||||
print_set(set6);
|
||||
|
||||
set_free(set1);
|
||||
set_free(set2);
|
||||
set_free(set3);
|
||||
set_free(set4);
|
||||
set_free(set5);
|
||||
set_free(set6);
|
||||
set_free(set1, NULL);
|
||||
set_free(set2, NULL);
|
||||
set_free(set3, NULL);
|
||||
set_free(set4, NULL);
|
||||
set_free(set5, NULL);
|
||||
set_free(set6, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -12,7 +12,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
TREESET_GENERATE(set, set, , int)
|
||||
CMC_GENERATE_TREESET(set, set, int);
|
||||
typedef struct set set;
|
||||
typedef struct set_iter set_iter;
|
||||
typedef struct set_node set_node;
|
||||
|
||||
|
||||
void print_tree(set_node *root, int height)
|
||||
{
|
||||
@@ -45,7 +49,7 @@ int main(int argc, char const *argv[])
|
||||
|
||||
print_tree(set1->root, 0);
|
||||
|
||||
set_free(set1);
|
||||
set_free(set1, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user