i have the following structure:
in main i have:Code:typedef struct in { char *nume; double val; } in;
and the function test:Code:int main() { in *t; void test(&t); return 0; }
the problem is that it segm faults me!Code:void test(in **a) { int i; (*a)=malloc(sizeof(in)); for(i=0;i<4;i++) { (*a)=realloc((*a),(i+1)*sizeof(in)); (*a[i]).nume=malloc(sizeof(char)); } }
What could the problem be ?
Thank you!