Reputation: 582
I've looked at several examples and none quite match my problem. I'm trying to define an array of struct, no biggie, but when I do this in Xcode using pure C, I get a "Expected Expression" error that's driving me nuts.
The Code is as follows:
struct myType {
unsigned char varName1;
unsigned char varName2;
unsigned char varName3;
};
struct myType myArray[10];
myArray[0] = {1,2,3}; // doesn't work at all despite many docs that say it will
myArray[1].varName1 = 1; // throws "expected expression" error
What am I doing wrong? I've checked for hidden characters, etc., nothing. It's clean and not imported into Xcode.
Upvotes: 1
Views: 152