Consider the following code fragment:
int main(void) {
int m = 4;
mystery ( m );
mystery ( m );
printf("%d", m);
return 0;
}
What is the output on the monitor if mystery is defined as
follows ?
void mystery (int m) {
m = m+3;
}
Answer Posted / c++ coder
Output will be 4 only.
since the argument is not passed by reference so a local
copy of m is used in the function call which is local to
mystery() it will not have any impact on the variable m
which is used in main() function.
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
Who calls main function?
Is there finally in c++?
What is the outcome of cout< a) 16 b) 17 c) 16.5
What are the important differences between c++ and java?
What is pointer with example?
Using a smart pointer can we iterate through a container?
What is the purpose of the "delete" operator?
What is the difference between #define debug 0 and #undef debug?
Is c++ low level?
Is map thread safe c++?
program explaining feautures of c++
What is meant by iomanip in c++?
What is a local variable?
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
What is the use of 'using' declaration in c++?