Created
August 25, 2024 08:04
-
-
Save mortymacs/d2e05edac46b3bf4d15d8a61adf37a50 to your computer and use it in GitHub Desktop.
Dictionary by Glib in C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//gcc dict.c `pkg-config --libs --cflags glib-2.0` | |
#include <glib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
GHashTable* hash = g_hash_table_new(g_str_hash, g_str_equal); | |
g_hash_table_insert(hash, "name", "Mort"); | |
g_hash_table_insert(hash, "email", "hello@localhost"); | |
printf("Welcome dear %s <%s>\n", g_hash_table_lookup(hash,"name"), g_hash_table_lookup(hash,"email")); | |
g_hash_table_destroy(hash); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment