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

Where does the name "C" come from, anyway?

637


What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers

669


What is bubble sort in c?

627


How do you define a string?

649


In c language can we compile a program without main() function?

567






a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

858


How can a string be converted to a number?

506


What is double pointer in c?

581


general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only

580


a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

4536


Why cant I open a file by its explicit path?

589


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

597


What does a function declared as pascal do differently?

599


Differentiate between functions getch() and getche().

615


What is ctrl c called?

585