Something that calls itself Magix wrote:
What is wrong with following code?
cat code.c
typedef struct msg_type {
word payLen;
datatype data[160];
} msg_type;
msg_type mymsg[10];
typedef struct datatype {
word myData;
} datatype;
mymsg[i].payLen = xxxx
for (k=0; k< mymsg[i].payLen; k++) {
mymsg[i].payLen.data[k].myData = yyyy;
}
gcc -Wall -std=c99 -pedantic -c code.c
code.c:2: error: syntax error before "word"
code.c:2: warning: no semicolon at end of struct or union
code.c:3: warning: type defaults to `int' \
in declaration of `data'
code.c:3: error: ISO C forbids data definition \
with no type or storage class
code.c:4: error: syntax error before '}' token
code.c:4: warning: type defaults to `int' \
in declaration of `msg_type'
code.c:4: error: ISO C forbids data definition \
with no type or storage class
code.c:6: error: syntax error before "mymsg"
code.c:6: warning: type defaults to `int' \
in declaration of `mymsg'
code.c:6: error: ISO C forbids data definition \
with no type or storage class
code.c:9: error: syntax error before "word"
code.c:9: warning: no semicolon at end of struct or union
code.c:10: warning: type defaults to `int' \
in declaration of `datatype'
code.c:10: error: ISO C forbids data definition \
with no type or storage class
code.c:12: error: `i' undeclared here (not in a function)
code.c:12: error: syntax error before '.' token