Basic Structure of C programming:

<Header File>

Function Declaration //Global Declaration
Variable Declaraion //Global Declaration

main()
{
Local Variable Declaration;
Execution Statements_1;
Execution Statements_2;
Execution Statements_3;
.
.
.
Execution Statements_n;
}

Other_function() //If necessary
{
Function Execution Statements_1;
Function Execution Statements_2;
Function Execution Statements_3;
.
.
.
Function Execution Statements_n;
}
-------------------------------------------------------------------------
Example Program:

#include<stdio.h>  //Header
#include<conio.h>
 

void function1(); //Global Function Declaration
int i=10;              //Global variable Declaration
 

void main()         //Main Function
{
        printf("Now in Main fn() and i=%d",i);
        function1();  //Function Call
        getch();
}
void function1()   //Optional Function Definition
{
printf("\nNow Jumped to another fn() and i=%d",i);
}

No comments:

Post a Comment

Let Us hear Your thoughts about this Post.. Its Our Pleasure to get your feedback..

Programs and Solutions