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
Are iterators pointers?
Is java the same as c++?
Is c++ an integer?
What is a class template?
Why do we use using namespace std in c++?
Can a list of string be stored within a two dimensional array?
what is pre-processor in C++?
What is the main purpose of c++?
Are strings mutable in c++?
Give example of a pure virtual function in c++?
What is implicit pointer in c++?
How would you use the functions randomize() and random()?
What is ios class in c++?
What is a forward referencing and when should it be used?
How the memory management in vectors are being done. What happens when the heap memory is full, and how do you handle it ?