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 are the different types of polymorphism in c++?
What is iomanip c++?
What operator is used to access a struct through a pointer a) >> b) -> c) *
Why do we use string in c++?
Is python written in c or c++?
Comment on local and global scope of a variable.
Are c and c++ different?
How can you quickly find the number of elements stored in a static array? Why is it difficult to store linked list in an array?
Is c++ a pure oop language?
How would you use the functions randomize() and random()?
Why is c++ called oops?
What's the hardest coding language?
Explain the pure virtual functions?
Is c++ the best programming language?
What is function prototyping?