Skip to main content

Posts

Showing posts from June, 2017

Local and Global variable

LOCAL AND GLOBAL VARIABLES LOCAL VARIABLE :- Variable that are declared inside the function is called local variable.These variable are also referred to as automatic variables. Local variable are referred only by statement that are declared inside the block in which the variable are declared. simple program for local variable #include<stdio.h> #include<conio.h> void main( ) { int x,y;              /* this is local variable*/ clrscr( );      printf("enter two number \n"); scanf("%d %d",&x,&y0; getch( );  } GLOBAL VARIABLE :- The variable declared outside the function are called global variables.They will hold their value throughout the program's execution. you create global variables by declaring them outside of all function.  simple program of global variable #include<stdio.h> #include<conio.h> int a ;                  /* a is global variable*/ void fun( ); void main( )