C Program Strucuture

C Program Structure.

Pre - Processor Directory( Start with # )
Global Declarations
Function Declaration
              declaration section
              executable section

W.A.P to add two no:-

void main()
  int a,b,c;
  printf("Enter first no\n");
  printf("Enter second no\n");
  printf("sum of a and b is "%d\n",c);


Enter first no
Enter second no
sum of a and b is

Pre-Processor directives

The pre-processor directives start with # ,these statement instruct the compiler to include some of the file in the beginning of the program for pre-define function.

this, is also called header file of a program.

Using the pre-processor directive the user can define the constants also:
For Example:-
#define MAX 120
#define p 3.147
 Here;    "MAX"  and  "p" is symbolic constant.

Global declarations and definitions

Global and Local there are two types of variable local variable can be declared in side a function but The variable that are declared before all the function are called global variables .the global variable can be access by all function.

The Program header

The program execution always start from the function main and it can be written as void main()

Body of a program:-
A series of statement that perform a specific action will be enclosed within braces { and } it is called body of a program.
The body of a program contain two essential part:-
getch()to hold result on screen or to view result.