Skip to main content

Basic Rules for programming

Before we move further , let us see some of the rules that are applicable to all C programs:

  1. Each instruction in a C program is written as a separate statement. Therefore, a complete C program would comprise a series of statements.
  2. The statement in a program must appear in the same order in which we wish them to be executed; unless of course the logic of the problem demands a deliberate 'jump' or transfer of control to a statement, which is out of sequence.
  3. Blank spaces may be inserted between two words to improve the readability of the statement. However, no blank spaces are allowed within a variable, constant or keyword.
  4. All statement are entered in small case letters.
  5. C has no specific rules for the position at which a statement is to be written. That's why it is often called a free-form language.
  6. Every C statement must end with a ; . Thus ; acts as a statement terminator.

Comments

Popular posts from this blog

Reversing digits of a number

#include<stdio.h> #include<conio.h> void main() { clrscr(); int ,num,rev=0,rem; printf("Enter the number:"); scanf("%d",&num); while(num!=0) { rem=num%10; rev=rev*10+rem; num=num/10; } printf("Reverse of given Number is:%d",rev); getch(); }