Pages

Showing posts with label call by value and call by reference. Show all posts
Showing posts with label call by value and call by reference. Show all posts

Thursday, 18 December 2014

call by value and call by reference



Call by Value      In  c  language by default  the arguments are passed to the function by value. It means  the actual arguments copy  their value into the formal arguments . In  call by value we can pass  the value  .if any change is  done into the formal arguments  it doesn't  affect the actual arguments because both  the arguments use the different memory location .

Program
#include<stdio.h>
#include <conio.h>
void  show ( int    a);
void main ()

{
Int x;
clrscr() ;
printf ( “enter the value “);
scanf(“%d”,& x);

show (x);
printf( “\n now value of x =%d” , x);
getch();
}
Void show ( int a )
{
a= a+1;
printf( “\n the value of a =%d”, a);
}