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

If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

0 Answers  


What is a program flowchart and how does it help in writing a program?

0 Answers  


What is the difference between typedef and #define?

0 Answers  


Is it better to use a macro or a function?

0 Answers  


main() { unsigned int k = 987 , i = 0; char trans[10]; do { trans[i++] =(char) (k%16 > 9 ? k%16 - 10 + 'a' : '\0' ); } while(k /= 16); printf("%s\n", trans); }

4 Answers   Vector,






Write a program to print factorial of given number without using recursion?

0 Answers  


int main() { int i=-1,j=-1;k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d%d%d%d%d",i,j,k,l,m); }

3 Answers   HCL,


What is the difference between array and linked list in c?

0 Answers  


int i=0,j; j=++i + ++i ++i; printf(" %d",j);

2 Answers   ME,


What does the error message "DGROUP exceeds 64K" mean?

0 Answers   Celstream,


What does. int *x[](); means ?

0 Answers   Wilco,


How do I swap bytes?

0 Answers  


Categories