This is a short list of coding standards that your programs should generally adhere to.

  1. Each Source File should have a comment block at the top, with your name, the date, the program filename, and a short description in it.
  2. Variables names should be self describing, exceptions being loop counters in for loops, etc.
    int myWeightInPounds; int timeoutInMsec;
  3. Function names should also be self describing
    CheckForErrors() instead of ErrorCheck(), DumpDataToFile() instead of DataFile().
  4. Use consistent case. camelCaseIsFine
  5. Indentation - always exactly 3 spaces, not tabs.
  6. No magic numbers - any number other than 0 or 1 should have a constant defined for it.
    Example: const int squareFeetInSquareYard = 9;
  7. Use spaces in all assignment statements, and always use brackets in control / repetition statements

    for ( int i = 0; i < someConstant; i++ )
    {
    //do something
    }

    if ( a == b )
    {
    //do something
    }

  8. Use meaningful comments to describe complex situations, avoid unless comments.