Computing 1 Style Guide

This document sets out the style which is to be followed in all submitted work in the course COMP1917 Computing 1.
  1. C Program Structure
  2. Names
  3. Layout
  4. if, while
  5. Declarations
  6. Functions
  7. Structs
  8. Comments
  9. Compiler Options
  10. Thanks

C Program Structure

  1. header comment
  2. #included files
  3. #defines
  4. local struct typedefs
  5. local prototypes
  6. global variables (only if absolutely necessary)
  7. main function (if present)
  8. local functions
  1. header comment
  2. #included files
  3. #defines
  4. struct typedefs
  5. prototypes
  6. (extern) global variables (only if absolutely necessary)

A header comment should include:

// Name, Student Number.
// Date.

// What this file is for (one line summary).

// Possible longer explanation, copyrights, etc.

Names

Layout

if, while

Declarations

Functions

Structs

Comments

Compiler Options

Thanks

Initially much of this document was based on "Appendix C: C Programming Standards" of Programming Techniques using the language C, Government of South Australia, Pearson Education Australia 2005. Subsequently it has been refined and revised based on the suggestions by the COMP1911 and COMP1917 teaching staff. Thanks to all who have contributed.