what is the output of below

int n=10;
(n++)++;
printf("%d",n);

Answers were Sorted based on User's Feedback



what is the output of below int n=10; (n++)++; printf("%d",n);..

Answer / abhijeet kankani

L-value required

Is This Answer Correct ?    22 Yes 1 No

what is the output of below int n=10; (n++)++; printf("%d",n);..

Answer / kirankumaryakkala

ans. error:Lvalue required
why? Lvalue means leftside assignment value,
here, first it goes to increment on N, again it is going to
increment, before going to increment second time, you should
allocate one varibale that holds the first time increment
value, other wise from where to it increment...

Is This Answer Correct ?    11 Yes 1 No

what is the output of below int n=10; (n++)++; printf("%d",n);..

Answer / deepak kumar

error : lvalue required.

n++ return 10 and after that n will increase to 1.
so now n=11
but next operation (postfix operator) is performing on
constant value 10 which is returned by (n++) operation.
it actually try to assign 11 to constant value 10. it is not
possible .
firstly we have to store it in a variable and then increment
can take place..

Is This Answer Correct ?    9 Yes 2 No

Post New Answer

More C Interview Questions

Is exit(status) truly equivalent to returning the same status from main?

0 Answers  


1.what are local and global variables? 2.what is the scope of static variables? 3.what is the difference between static and global variables? 4.what are volatile variables? 5.what is the use of 'auto' keyword? 6.how do we make a global variable accessible across files? Explain the extern keyword? 7.what is a function prototype? 8.what does keyword 'extern' mean in a function declaration?

0 Answers  


Is the following code legal? struct a { int x; struct a b; }

4 Answers  


What is pre-emptive data structure and explain it with example?

0 Answers  


give one ip, find out which contry

4 Answers   Google,


1.write a program to merge the arrays 2.write efficient code for extracting unique elements from a sorted list of array?

3 Answers   Qualcomm,


what is memory leak?

3 Answers  


What is diffrance between declaration and defination of a variable or function

4 Answers  


What is the use of structure padding in c?

0 Answers  


Is a house a mass structure?

0 Answers  


Given an array of characters, how would you reverse it? How would you reverse it without using indexing in the array?

1 Answers   Microsoft,


What was noalias and what ever happened to it?

0 Answers  


Categories