STRUCTURE OF C PROGRAM

STRUCTURE OF C PROGRAM

INCLUDE HEADER FILE SECTION
C program depends upon some header files for function definition that are used in program.
Each header file by default is extended with .h. The header file should be included using # include
directive as given here.
for example #include<stdio.h>

GLOBAL DECLARATION
This section declares some variables that are used in more than one function. These variables
are known as global variables. This section must be declared outside of all the functions.

FUNCTION MAIN( )
Every program written in C language must contain main () function. The function main() is
a starting point of every C program. The execution of the program always begins with the function
main ().

DECLARATION PART
The declaration part declares the entire variables that are used in executable part. The
initialisations of variables are also done in this section. Initialisation means providing initial value
to the variables.

EXECUTABLE PART
This part contains the statements following the declaration of the variables. This part contains
a set of statements or a single statement. These statements are enclosed between the braces.


PROGRAM:-
PROGARAM TO CONVERT TEMPERATURE FROM DEGREE CENTIGRADE TO FAHRENHEIT.

#include<stdio.h>
#include<conio.h>
void main( )
{
float c,f;
clrscr( );
printf("enter temp in centigrade:");
scanf("%f",&c);
f=(1.8*c)+32;
printf("temp in fahrenheit=%f",f);
getch( );
}


OUTPUT:- enter temp in centigrade: 32
                   temp in fahrenheit=89.59998

Comments