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

Tell me a C program to display the following Output? 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5

3 Answers  


1 232 34543 4567654 can anyone tell me how to slove this c question

6 Answers  


Why static variable is used in c?

0 Answers  


what does ‘#include’ mean?

1 Answers   TCS,


what is foreign key in c language?

1 Answers   ADP,






Write a c program to read a positive number and display it in words.? ex: 123=one two three help me....

2 Answers  


Write a program to find the number of times that a given word(i.e. a short string) occurs in a sentence (i.e. a long string!). Read data from standard input. The first line is a single word, which is followed by general text on the second line. Read both up to a newline character, and insert a terminating null before processing. Typical output should be: The word is "the". The sentence is "the cat sat on the mat". The word occurs 2 times.

0 Answers  


Explain what is the difference between the expression '++a' and 'a++'?

0 Answers  


How to reverse a string using a recursive function, without swapping or using an extra memory?

31 Answers   Cisco, Mind Tree, Motorola, Ophio, Sony, TCS, Wipro,


What is volatile

2 Answers  


Write a program which take a integer from user and tell whether the given variable is squar of some number or not. eg: is this number is 1,4,9,16... or not

9 Answers   Alcatel,


Why array starts with index 0

2 Answers  


Categories