-
The value printed by the following program is _______.
void f(int* p, int m){
m = m + 5;
*p = *p+m;
return;
}
void main () {
int i=5, j=10;
f(& i, j);
printf (“%d”, i+j);
}
-
- 0
- 10
- 15
- 30
Correct Option: D
The address of i and value of j are passed to the function of f. f modifies i’s value to 20. j’s value remains same (as its value is passed not the reference). The value printed by the program will be i + j = 20 + 10 = 30.