Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

23 lines
459 B

#include <stdio.h>
#include "dict.h"
int main() {
int zero = 0;
float one = 1.0;
char two[] = "two";
dictionary *d = dictionary_new();
dictionary_add(d, "an int", &zero);
dictionary_add(d, "a float", &one);
dictionary_add(d, "a string", &two);
printf("The integer I recorded was: %i\n", *(int*) dictionary_find(d, "an int"));
printf("The string I recorded was: %s\n", (char*) dictionary_find(d, "a string"));
dictionary_free(d);
}