C Naming Conventions

Overview

This page explains my preferred naming convention style for C code.

Variables

All local variables begin with a lower-case letter and use camel-case, except those that are function pointers, which begin with a capital letter. Only the first letter in an acronym is capitilised, e.g.

All file-level and global variable use the same syntax except with an underscore in front of them.

Functions

Functions start with the file/module name, an underscore, and then a description. All functions use camel-case and begin with a capital letter. For example, a function in a file called Gps.c would look like…

Typedefs

Typedefs aways end in _t. The helps the reader instantly disguish a data type from anything else, and also serves to distinguish user defined data types (e.g. uint8_t, myType_t) from system data types (e.g. char, double, int).