Hi ,
Have the following case passing in structure pointers and returning structure pointers
can anyone spot whats wrong with this
structure name is structCar
Have the following case passing in structure pointers and returning structure pointers
can anyone spot whats wrong with this
structure name is structCar
Code:
void callfn( ){ structCar *Result; char var1[20], var2[20], var[20]; strcpy (var1,"test1"); strcpy (var2,"test2"); *Result = myfunc(var1,var2); callfn2(&result,var); } structCar * myfunc(char *abc char *bef){ resPtr = (structCar*) malloc (sizeof(structCar) * 2); anotherfncall(&result, &abc, &bef) resPtr = &result; return resPtr; /*Returns a ptr to a structure */ } void callfn2(const structCar *, char *){ other stuff } anotherfncall(structCar *, const structCar *, const structCar *){ }
Comment