main()
{ int i=5;
printf("%d",++i + i);
} output is 10
------------------------
main()
{ int i=5;
printf("%d",i++ + i);
}output is 12
why it is so? give appropiate reason....
Answer Posted / sudarsan.tuku@gmail.com
1>On the 1st que the ans. is 12
bcz perform the pre increment 1st then add them.
After the pre increment the value of i becomes 6 and
then it perform the add operation i.e. i+i=6+6=12.
2>output is 10
It 1st perform the pre operation but there is no pre
operation in the que.
2ndly it perform the operation i.e i+i=5+5=10.
3rdly it perform post operation i.e i++ so i becomes 6.
but here the output is 10.
| Is This Answer Correct ? | 16 Yes | 2 No |
Post New Answer View All Answers
Define recursion in c.
How is actual parameter different from the formal parameter?
What is the explanation for modular programming?
difference between native and cross compilers
Can one function call another?
Is main is user defined function?
How do you generate random numbers in C?
What do you mean by a sequential access file?
What is the function of this pointer?
How can I run c program?
What are examples of structures?
What is a newline escape sequence?
Tell me is null always defined as 0(zero)?
Was 2000 a leap year?
can anyone please tell about the nested interrupts?