Make a programme in C (not in C++) to diffentiate between call by value and call by reference
It should be easy plzzzzzzzzzzzzz
I have need of this programme.
Plz make a programme in C to differentiate between call by value and call by reference?
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
void increment1(int a)
{
a++;
}
void increment2(int *a)
{
(*a)++;
}
void main()
{
int a=1;
printf("Value of a = %d\n",a);
//call by value
increment1(a);
printf("Value of a = %d\n",a); //value of a remain same
//call by reference
increment2(%26amp;a);
printf("Value of a = %d\n",a); //value of a incremented
getch();
}
yucca
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment