Where T_ocean is an Array build with a Struct of an Enum and a regular int.
exemple:[enum1,enum2,enum3][random int value]
This function is just simply supposed to set both value of the "enum" and the "int" inside the array as "empty" yet it refuse to do so and give me an error.
The error is : expected primary-expression before '[' token . on line8
expected primary-expression before '[' token . on line9
I expect something like that to be due to syntax yet I can't find the bug. Could anyone enlighten me?
You declared T-ocean incorrectly in your function. It should read
void init_ocean(T_Case T_ocean[LARGEUR])
And this is IF you did not declare it as a global which is what I suspect from the first code but not entirely sure. I never seen struct used like that inside a function, it should be there.
Thank you for your help. Indeed the TypeDef was not global and putting it outside the main seem to have cleared the previous error message. Although, now, other kinds showed up.
1) Wouldn't Struct and T_case be equivalent since they are both the same type?
2) Removing the prototype void init_ocean(T_case T_ocean[HAUTEUR][LARGEUR]);
Seem to clear all error code. otherwise I get errors such as:
- variable or field `init_ocean' declared void
-`T_case' was not declared in this scope (although T_case is now global)
- previous declaration of `int init_ocean'
- conflicts with function declaration `void init_ocean(T_case (*)[10])'
Should I just remove the Prototype? Wouldn't that affect how the compiler compile the Function first then the rest of the main? I though prototype were mandatory?
P.s
I just realized why removing the prototype would clear my problem. I put the prototype before the Typedef making the compiler look for for something that came after.