So i have this structure jogo and i want to create a variable of that type and inicialize it and modify it.
typedef struct jogo
{
int ident;/*idp of a product*/
char *nome; /* string that describes a team eg. Barcelona */
char **equipas; /*array of strings e.g. ["Barcelona","Madrid"]*/
int *score; /*array of ints e.g. [1,2]*/
}* jogo;
jogo *sistema_jog;
To do that i created an init funcion the problem is that when i call it on the main i get segmentation fault core dumped error and i dont understand why.
void init(jogo s)
{
s = (struct jogo*) calloc(MAX_SIZE,sizeof(struct jogo));
s->equipas = (char**) calloc(2,sizeof(char));
}
Really any help would be appreciated.