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 |
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
What is a program flowchart and how does it help in writing a program?
What is the difference between typedef and #define?
Is it better to use a macro or a function?
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); }
Write a program to print factorial of given number without using recursion?
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); }
What is the difference between array and linked list in c?
int i=0,j; j=++i + ++i ++i; printf(" %d",j);
What does the error message "DGROUP exceeds 64K" mean?
What does. int *x[](); means ?
How do I swap bytes?