Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "map.h"
- void print_key(struct Map *map, char *key)
- {
- printf("%s: %s\n", key, Map_get(map, key));
- }
- int main(int arcg, char *argv[])
- {
- struct Map *map = Map_create();
- printf("Map length: %d\n", map->length);
- Map_put(map, "name", "Andres");
- Map_put(map, "age", "17");
- Map_put(map, "favorite drink", "coffee");
- Map_put(map, "favorite color", "blue");
- print_key(map, "name");
- print_key(map, "age");
- print_key(map, "favorite color");
- print_key(map, "favorite drink");
- printf("Map length: %d\n", map->length);
- Map_remove(map, "age");
- print_key(map, "age");
- printf("Map length: %d\n", map->length);
- Map_put(map, "age", "18");
- print_key(map, "age");
- printf("Map length: %d\n", map->length);
- free(map);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement