Rectangle: Click to edit Master text styles
Second level
Third level
Fourth level
Fifth level
Call by reference:
Memory allocation process
wvoid swap(int *x, int *y)
w{   int temp;
w
w temp = *x;
w *x = *y;
w *y = temp;
w}
w
wint main(){
w    int i = 10, j=6;
w    swap(&i, &j);
w}
Call by value in this context means when the execution enters the body of swap, its formal parameters are initialised as if two assignments are executed:
x = &i;
y = &j;