Originally Posted by
Zeus_
thank you so much
what exactly happen call by reference
Code:
#include<stdio.h>
/* function declaration */
void passbyrefrence(int *x, int *y);
void passbyrefrence(int *x, int *y)
{
printf("\n After pass, value of x : %d\n", *x );
printf("\n After pass, value of y : %d\n", *y );
printf("\n After pass, address of x : %p \n", x );
printf("\n After pass, address of y : %p \n", y );
printf ("\n");
}
int main () {
/* local variable definition */
int a = 100;
int b = 200;
printf("Before pass, value of a : %d\n", a );
printf("Before pass, value of b : %d\n", b );
printf("Before pass, address of a : %p \n", &a );
printf("Before pass, address of b : %p \n", &b );
passbyrefrence(&a, &b);
printf("After pass, value of a : %d\n", a );
printf("After pass, value of b : %d\n", b );
printf("after pass, address of a : %p \n", &a );
printf("after pass, address of b : %p \n", &b );
return 0;
}
Before pass, value of a : 100
Before pass, value of b : 200
Before pass, address of a : 0061FF2C
Before pass, address of b : 0061FF28
After pass, value of x : 100
After pass, value of y : 200
After pass, address of x : 0061FF2C
After pass, address of y : 0061FF28
After pass, value of a : 100
After pass, value of b : 200
after pass, address of a : 0061FF2C
after pass, address of b : 0061FF28
definition say we pass parameter by reference
Code:
passbyrefrence(&a, &b);
What is meaning of this line ?
does it pass the address of a and b or it pass the content of a and b to x and b at the address a and address of b