typedef struct { int start_x; int end_x; int y; char* text; } main_menuitem; typedef struct tab_menuitem tab_menuitem; struct tab_menuitem { int end_x; int y; bool visible; void (*load_content) (); tab_menuitem *next; tab_menuitem *previous; char* text; }; void fill_string ( char* location, char string[500] ) { location = NULL; if ((location = realloc ( location, ( strlen ( string ) + 1 ) ))==NULL) { exit(0); } strcpy ( location, string ); } void set_end_x( tab_menuitem *menu ) { menu->end_x = strlen ( menu->text ) + 3; if ( menu->next != NULL ) { set_end_x ( menu->next ); } } fill_string ( f1.text, "" ); first_tab_menuitem = &general; set_end_x ( first_tab_menuitem );