Programming Rules
A programmer while writing a program should follow following rules.
- Every program should have main() function.
- 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. - An unessential semicolon if placed by the programmer is treated as an empty statement.
- All statements should be written in lowercase letters. Generally, uppercase letter are used only for symbolic constants.
- 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.
- 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; - The opening and closing braces should be balanced, i.e. if opening braces are four; closing braces should also be four.