Hello everyone,
I would like to know how I can create a static data type structure where the information is always kept in memory even if it calls different functions or executes some other code outside its main function.
Every time I call a function the data is lost on the list.
typedef struct director_users dir_users; struct director_users { int count; //Id char name[10]; //Name char time1[10]; //Pos struct director_users *p1; }; static dir_users *directorio=NULL;
When I create the linked list the information is stored correctly but when calling another function the information disappears from the list.
crearUserdir(directorio,"String1","String2"); functionTest();
Regards,
Actually the original code does seems to return the head of the list all the time. It needs to be assigned back to the variable that contains the head of the list. Then this post would have never happened.
what you added seems to either return the head of the list (if it was NULL), or the item 1 before the last item in the (new) list.