I have a basic structure like this
typedef struct struck {
char* id;
char* mat;
int value;
char* place;
} *Truck;
And afunction like this which creates a new "instance" of that struct:
Truck CTruck(char* id, char* mat, int value, char* place) {
Truck nT = (Truck) malloc(sizeof (Truck));
nT->value = value;
strcpy(nT->id, id);
strcpy(nT->mat, mat);
strcpy(nT->place, place);
return nT;
}
I'm getting an error in the first strcpy
. It compiles without problem.