If you have a fixed number of users (say
10
) then declare
#define USERS 10
struct mine_struct *p[USERS];
and then, at runtime, create and fill the details of proper item, e.g.
if (user == 5)
{
p[user] =(struct mine_struct *) malloc(sizeof(struct mine_struct));
if (p[user])
p[user]->a = 21;
}
Then, when you don't need anymore it
if ( p[user] )
{
free(p[user]);
p[user] == NULL;
}