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.

22 lines
459 B

  1. #include <stdio.h>
  2. #include "dict.h"
  3. int main() {
  4. int zero = 0;
  5. float one = 1.0;
  6. char two[] = "two";
  7. dictionary *d = dictionary_new();
  8. dictionary_add(d, "an int", &zero);
  9. dictionary_add(d, "a float", &one);
  10. dictionary_add(d, "a string", &two);
  11. printf("The integer I recorded was: %i\n", *(int*) dictionary_find(d, "an int"));
  12. printf("The string I recorded was: %s\n", (char*) dictionary_find(d, "a string"));
  13. dictionary_free(d);
  14. }