C Good Practices


There are certain things that you can do when creating software, from design through to naming your variables.

Mentioned in part one of the tutorial is the use of Hungarian notation ( or some standard notation ). Hungarian notation defines a standard way to name variables. It makes sense, here are a few that I use often, for the full list I will find a link.

int i array a
char c pointer p
float f unsigned u
word w long l
byte b    

Now how to use them :

char cDataIn A single character
char * pcDataIn A pointer to a character
char acString[10] An array of characters
char ** ppcDataIn A pointer to a pointer pointing at a char

Does that make sense ? I hope so. Notice also that the actual name apart from the suffix notation should make sense.


Modular Coding

When designing your software you should decide what parts of the system there are. What data there is. By putting like things in like files we can split the software project into small manageable chunks. There is a question here as to how much code should be in a single file. I work along the lines of , "Whatever makes sense to be together should be together".

 

Index


Last Updated 15 February 1998 by Nik Swain (email: nikswain@oocities.com)

This page hosted by Geocities Icon Get your own Free Home Page