what is the output of below

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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between c and python?

586


why do some people write if(0 == x) instead of if(x == 0)?

655


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

618


How we can insert comments in a c program?

634


What is function pointer c?

586






please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com

1329


How can I manipulate individual bits?

608


How can I write a function that takes a format string and a variable number of arguments?

605


What is the difference between text and binary i/o?

592


What are the different types of pointers used in c language?

613


What is 1f in c?

1839


What is the use of function in c?

715


What is the difference between text files and binary files?

679


What is nested structure with example?

625


How can I generate floating-point random numbers?

609