Friday 4 August 2017

pass by value example

//Pass by value:
#include"stdio.h"
#include"conio.h"
//Decliration
void addconstant(int,int);
int a=100,b=90;
void main()
{
    printf("a=%d , b=%d",a,b);
    addconstant(a,b);
    printf("\ta=%d , b=%d",a,b);
    getch();
}
//Defination
void addconstant(int x,int y)
{
    x=x+y;
}

0 comments: