what is the output of below
int n=10;
(n++)++;
printf("%d",n);
Answers were Sorted based on User's Feedback
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 |
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 |
Explain 'far' and 'near' pointers in c.
What is the output of the below program and how it is? void main() { static int var=5; printf("%d",var--); if(var) main(); }
8 Answers MindFire, TCS, Tech Mahindra,
What is binary tree in c?
Explain what is the difference between the expression '++a' and 'a++'?
What is variable and explain rules to declare variable in c?
What is the purpose of void in c?
What is wrong in this statement? scanf(“%d”,whatnumber);
what is the function of pragma directive in c?
find the size of structure without using the size of function
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
Explain how can I convert a string to a number?
simple c program for 12345 convert 54321 with out using string