Programming Rules

A programmer while writing a program should follow following rules.
  1. Every program should have main() function.
  2. C statements should be terminated by a semi-colon (;). At some place, a comma operator is permitted. If only a semi-colon is placed it is treated as a statement. For example:-
                             while(condition)
                             ;
    The above statement generates infinite loop. Without semi-colon the loop will not execute.
  3. An unessential semicolon if placed by the programmer is treated as an empty statement.
  4. All statements should be written in lowercase letters. Generally, uppercase letter are used only for symbolic constants.
  5. Blank space my be inserted between the words. This leads to improvement in the read-ability of the statements. However this is not applicable while declaring a variable, keyword, constant and function.
  6. It is not necessary to fin the position of statement in the program; i.e. a programmer can write the statement anywhere between the two braces following the declaration part. The user can also write one or more statements in one line separating them with a semi-colon. Hence it is often called a free-from language. The following statements are valid.
    a=b+c;
    d=b*c;
    or
    a=b+c; d=b*c;
  7. The opening and closing braces should be balanced, i.e. if opening braces are four; closing braces should also be four.

Popular posts from this blog

Shutdown Pc

Ellipse using OpenGl

String Comparisons