June 23, 2019
call by value
call by reference
call by value result
None of these.
Currently there is no PrepInsta Explanation. Did you know?
You can also submit your own version of explanations under user explanation section and also view other submitted explanations by other users.
Please login to submit your explanation
You can check your performance of this question after Login/Signup
int i = 5;
printf("%d%d%d%d%d", i++, i--, ++i, --i, i);
When passing an argument in a function all the arguments and local variables are stored in a memory called stack. After the function being called stack have to be deleted either by called function or by calling function. But in the standard convention, it deleted by the called function. we have two choices:
1) From left to right.
2)From right to left.
This depends upon the calling convention, which is right to left.
The arguments in a function call are pushed into the stack from left to right. The evaluation is by popping out from the stack. and the evaluation is from right to left,
The arguments in a function call are pushed into the stack from left to right. The evaluation is by popping out from the stack. and the evaluation is from right to left, hence the result. See the picture below
Function mcq solution image
int f(int x)
if(x <= 4)
printf("%d ", f(7));
4 5 6 7
1 2 3 4
In this recursive function call the function will return to main caller when the value of x is 4. Hence the output.
extern int var;
var = 10;
printf("%d ", var);
extern only defines it but allocates no memory so compiler error.
Please login to report
Login/Signup to comment