Basic structure of c program

                         Program structure
I am going to explain basic structure of  basic structure of c# program.By this simple  you  can definitely understand how to write program?
/* documentation
   ankit c guru 
http://ankitcguru.blospot.com/
   
*\

#include<stdio.h>//including header files which contains user defined functions
#include<conio.h>//including header files which contains user defined functions
#define pi 3.142  //This section is used to define symbolic constants
#define maxmarks 100//This section is used to define symbolic constants
#define minmarks 35//This section is used to define symbolic constants
int a 
/*Global variables are declared out side the main function this can be used anywhere in program*/
void main()// main function
{
/*local variables*/ 
int d=10,e;
float b,
c;char name;
//scanf(“format specifier”,&var1,&var2-----,&varn);
scanf(“%d”,&d)//scanf() function is used to read the data from standard input device
// for int data-type
printf(“ankit c guru”);
//printf(“ message -format specifier”,var1,var2-----,varn);
 printf(“value of d=%d”,d);

Example:-
/* c-program to find sum of two numbers *\
#include<stdio.h>//link section
#include<conio.h>
main()
{int a,b,sum;// local variable declaration
clrscr();
printf("enter two numbers \n");
scanf("%d%d",&a,&b);// reading input from std i/p
sum=a+b;//computation part
printf("sum of two numbers=%d",sum);//ouput
getch();
}

Comments

Popular posts from this blog