Compiler Error C2143 when using a struct

I’m compiling a simple .c in visual c++ with Compile as C Code (/TC) and i get this compiler error

error C2143: syntax error : missing ‘;’ before ‘type’

on a line that calls for a simple struct

 struct foo test;

same goes for using the typedef of the struct.

error C2275: ‘FOO’ : illegal use of this type as an expression

Answer

I forgot that in C you have to declare all your variables before any code.

Source: stackoverflow
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .