This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

static structure in C keep list of information in memory

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.

Fullscreen
1
2
3
4
5
6
7
8
9
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;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

When I create the linked list the information is stored correctly but when calling another function the information disappears from the list.

Fullscreen
1
2
crearUserdir(directorio,"String1","String2");
functionTest();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Regards,

0