What is the output of the following code:
int v()
{
int m=0;
return m++;
}
int main()
{
cout<<v();
}




1) 1


2) 0


3) Code cannot compile

Answers were Sorted based on User's Feedback



What is the output of the following code: int v() { int m=0; return m++; } int main() { cou..

Answer / shailaja

the output of this code is

0
bcz here the return statement it will stops the execution
and returns to the calling function.

Is This Answer Correct ?    8 Yes 0 No

What is the output of the following code: int v() { int m=0; return m++; } int main() { cou..

Answer / sivasankar

output is 0

Is This Answer Correct ?    7 Yes 1 No

What is the output of the following code: int v() { int m=0; return m++; } int main() { cou..

Answer / raju

ans 0

first it return value ofter that it increment

Is This Answer Correct ?    3 Yes 2 No

What is the output of the following code: int v() { int m=0; return m++; } int main() { cou..

Answer / durga shankar mishra

write answer of the 0

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More OOPS Interview Questions

What is a scope operator and tell me its functionality?

3 Answers   emc2,


I hv a same function name,arguments in both base class and dervied class, but the return type is different. Can we call this as a function overloading? Explain?

3 Answers  


What is class and object with example?

0 Answers  


Prepare me a program for the animation of train

0 Answers  


What is virtual function?where and when is it used?

2 Answers   Sitel,






write a short note on Overloading of Binary Operator?

2 Answers  


What is destructor oops?

0 Answers  


What is ambiguity in inheritance?

0 Answers  


What is the use of fflush(stdin) in c++?

4 Answers   HCL,


What is difference between pop and oop?

0 Answers  


Give two or more real cenario of virtual function and vertual object

0 Answers   TCS,


What is persistence in oop?

0 Answers  


Categories