Divide each module up into a public part (what's needed to use the module) and a private part (what's needed to get the job done). The public part goes into a .h file while the private part goes into a .c file.
Short names such as x , y , and i are acceptable when their meaning is clear and when a longer name would not add information or clarity.
Use argc for the number of command line arguments and argv for the argument list. Do not use these names for anything else.
The exponent in a floating-point number must be a lowercase e . This is always followed by a sign.
When splitting a conditional clause ( ? : ), write it on three lines: the condition line, the true-value line, and the false-value line. Indent the second and third line an extra level.
In C expressions, you can assume that * , / , and % come before + and - . Put parentheses around everything else.
#define constants are declared like variables. Always put a comment describes the constant after each declaration.
#include directives come just after the heading comments. Put system includes first, followed by local includes.
Comment #else and #endif directives with the symbol used in the initial #ifdef or #endif directive.
Define (or undefine) conditional compilation control symbols in the code rather than using the -D option to the compiler.
Do not comment out code. Use conditional compilation ( #ifdef UNDEF ) to get rid of unwanted code.