#include typedef struct { gint id; gchar *name; } TestStruct; static GSList * insert (GSList *list, gint id, const gchar *name) { TestStruct *test; test = g_new (TestStruct, 1); test->id = id; test->name = g_strdup (name); list = g_slist_append (list, test); return list; } gint main (gint argc, gchar **argv) { GSList *list = NULL; GSList *node; TestStruct *structPtr; /* Insert */ list = insert (list, 0, "Test1"); list = insert (list, 1, "Test2"); list = insert (list, 2, "Test3"); /* Retrieve pointers to TestStructs from list */ node = g_slist_next (list); structPtr = node->data; g_print ("Retrieved struct with id: %d and name: %s\n", structPtr->id, structPtr->name); return 0; }