Hi, I'm now in a job where I have to code in pure C (not C++) and am having trouble adjusting to the differences, hope you can help. As soon as I un-comment any one of the commented lines in the code snippet below, the program fails to compile with a syntax error on the "int a=0..." line after the commented block (This line isn't a problem while the rest is commented out). I haven't been able to identify the problem, even after searching the internet, am I missing something about the assignment operator/structs/arrays in C?
Code:
typedef struct touch_switch {
int p_loc;
} touch_switch_t;
void touch_switches_set(touch_switch_t *switches[]);
void main(void) {
touch_switch_t S[8];
/* S[0].p_loc = 0x0;
S[1].p_loc = 0x1;
S[2].p_loc = 0x4;
S[3].p_loc = 0x5;
S[4].p_loc = 0x2;
S[5].p_loc = 0x3;
S[6].p_loc = 0x8;
S[7].p_loc = 0x9;*/
/* touch_switches_set(&S);*/
int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0;
}
void touch_switches_set(touch_switch_t *switches[]) {
(*switches)[0].p_loc = 0x0;
(*switches)[1].p_loc = 0x1;
(*switches)[2].p_loc = 0x4;
(*switches)[3].p_loc = 0x5;
(*switches)[4].p_loc = 0x2;
(*switches)[5].p_loc = 0x3;
(*switches)[6].p_loc = 0x8;
(*switches)[7].p_loc = 0x9;
}