C
ProgrammingAnother interesting datatype is the one of "trees".
gboolean prn(GNode* node, gpointer data) {
if(node->data!=NULL) {
g_print(node->data);
g_print(" ");
}
return 0;
}
void main() {
GNode* root = g_node_new(NULL);
GNode* v0 = g_node_new("0");
g_node_append(root,v0);
GNode* v1 = g_node_new("1");
g_node_append(root,v1);
GNode* v00 = g_node_new("00");
g_node_append(v0,v00);
GNode* v01 = g_node_new("01");
g_node_append(v0,v01);
GNode* v10 = g_node_new("10");
g_node_append(v1,v10);
GNode* v11 = g_node_new("11");
g_node_append(v1,v11);
g_node_traverse(root, G_LEVEL_ORDER, G_TRAVERSE_LEAVES,-1,prn,NULL);
}