[prev] 56 [next]

Sidetrack: C Style (cont)

UNSW Computing provides a style guide for C programs:

C Coding Style Guide    (http://wiki.cse.unsw.edu.au/info/CoreCourses/StyleGuide)


Not strictly mandatory for COMP9024, but very useful guideline

Style considerations that do matter for your COMP9024 assignments:

  • use proper layout, including consistent indentation
    • 3 spaces throughout, or 4 spaces throughout
      do not use TABs
  • keep functions short and break into sub-functions as required
  • use meaningful names (for variables, functions etc)
  • use symbolic constants to avoid burying "magic numbers" in the code
  • comment your code