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;
}
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / rahul darekar
since in c lang we have to define fun first before we use it
but in this program fun mystery() in not defined and still
it is called so it will give error.
| Is This Answer Correct ? | 3 Yes | 1 No |
How Virtual functions call up is maintained?
When should we use container classes instead of arrays?
How long does this loop run: for(int x=0; x=3; x++) a) Never b) Three times c) Forever
17 Answers Datavance, Quark, VEL, Wipro,
Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?
Which of the following is not a valid declaration for main() a) int main() b) int main(int argc, char *argv[]) c) They both work
write the prime no program in c++?
Why iomanip is used in c++?
why c++ is not called strictly d super set of c?
Show the application of a dynamic array with the help of an example.
What is unary operator? List out the different operators involved in the unary operator.
Explain the benefits of proper inheritance.
How is new() different from malloc()?