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
What is difference between c++ 11 and c++ 14?
What is the type of 'this' pointer?
Explain selection sorting?
What are the c++ access specifiers?
. If employee B is the boss of A and C is the boss of B and D is the boss of C and E is the boss of D. Then write a program using the Database such that if an employee name is Asked to Display it also display his bosses with his name. For eg. If C is displayed it should also display D and E with C?
Explain the uses of static class data?
Why isn't sizeof for a struct equal to the sum of sizeof of each member?
Explain the use of vtable.
Write a note about the virtual member function?
What causes a runtime error c++?
What is the best c++ ide?
Explain the different access specifiers for the class member in c++.
What is a singleton class c++?
How are the features of c++ different from c?
what is a reference variable in C++?