C Coding Guidelines

H. John Reekie (johnr@eecs.berkeley.edu)
7 January 1993.

Copyright (©) H. John Reekie 1992, 1993, 1994. This document may be freely copied and distributed in electronic or paper form for non-commercial use, provided that the whole document is copied with this notice intact. Reception of comments and suggestions on this document is assumed to constitute permission to incorporate them into future revisions, together with an appropriate acknowledgement.


This document is a set of coding guidelines for the C programming language. The purpose of guidelines such as these is to improve:

As an individual, guidelines provide you with a set of coding style and program structuring rules selected from any number of alternatives. At an individual level, coding style is often a matter of personal taste, so as you become more proficient in C, you can choose to apply different guidelines to your code.

At the level of an organisation, guidelines provide a consistent coding style for all members of the organisation. In this situation, your code will most likely be used, read, extended, interfaced-to, modified, documented, and ported by many other people, so it is important that a consistent style be enforced across the organisation. See (Strakker 92) for a discussion on the need for guidelines and standards.

This document is written mainly for use in an educational environment, and deals only with coding style. The guidelines are presented as recommendations, not as a ``standard,'' although they can be adopted as a standard if appropriate.

Note that this document does not attempt to teach C; nor does it deal with program design or documentation, except as manifested in the C source code.