I have the following code written in C:
n. struct UDSData {
char *name;
char *address;
};
n. char UDS1[16] = "fill up sixteen", UDS2[16] = "fill up sixteen";
n. while (something) {
...
108. char UDS1Temp[16], UDS2Temp[16];
109. strcpy(UDS1Temp, UDS1);
110. strcpy(UDS2Temp, UDS2);
111.
112. struct UDSData item = {UDS1Temp, UDS2Temp};
113. UDSCodes[UDSTotal++] = item;
}
Any idea why the code compiles to give these errors:
1><file>(112): error C2143: syntax error : missing ';' before 'type'
1><file>(113): error C2065: 'item' : undeclared identifier
1><file(113): error C2440: '=' : cannot convert from 'int' to 'UDSData'
Removing the strcpy()
and inputting UDS1
and UDS2
directly into the struct works.