C tips


Readability


Most important quality of source code is readability. More important than efficiency.


Avoid too long lines


Limit lines in your program to 80 characters long whenever possible.

It improves readability.

If your lines tend to be longer than that think of redesigning your program.


Naming types using _t suffix


POSIX standard reserves _t suffix for itself, so naming types using _t suffix is discouraged.

typedef struct { whatever } my_struct_t; Discouraged


Using booleans in C


Using booleans in C


Sequence points


Sequence point is a point in a computer program where all side effects are guaranteed to have been performed.

C FAQ: What is a sequence point?

Sequence point (wikipedia)