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( )
Hierarchy operation if we use two or more operator in arithmetic instruction than we use hierarchy operator problem . the priority or precedence in which the arithmetic operator are perform called hierarchy operations. example:- 2*x-3*y , a/(b*c). Associativity operators: - when an expression take two or more operator of same priority. Than the tie between them and we use associativity of the operator. associativity are to type:- 1. left to right :- it means that the left operand must be unambiguous (non- confusing) . 2. right to left :- it mean the right operand must be unambiguous (non- confusing). example:- a=3/2*5;