The most important rules are as follows:
if () { int i; ... }
or
for (i=0; ...) { int a; ... }
int func(int x) { /* body */ }
foo.c
and associated header file foo.h
with interface to the source file, make sure that foo.c
includes foo.h
as the very first header file. This way the compiler will report an error if there is a header file missing in foo.h
.