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 a lambda function c++?
Is c the same as c++?
Explain container class.
Differentiate between a pointer and a reference with respect to c++.
Why do we need templates?
What is java and c++?
When can I use a forward declaration?
Is turbo c++ free?
What is the need of a destructor?
Must accepts "Maestro Cards" Tax for bike should be less than 15 Total number of lanes is more than 10 Must provides monthly pass Write a method: boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes); String[] cardsAccepted A String array of names of card types accepted for payment of toll tax, it can be null if the toll does not accept any card String[] tollTax A String array of toll tax chart (say “Train : 300â€Â,â€ÂBullCart : 10â€Â) boolean hasMonthlyPass This parameter defines whether there is any monthly pass available or not int numberOfLanes This parameter defines the number of lanes for each side
What is the oldest programming language?
Write a C++ Program to check whether a number is prime number or not?
What is virtual base class uses?
Is c++ slower than c?
How is static data member similar to a global variable?