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
Is c procedural or functional?
Can we access array using pointer in c language?
how we can make 3d venturing graphics on outer interface
What is header file definition?
In a switch statement, what will happen if a break statement is omitted?
Define circular linked list.
What is the difference between near, far and huge pointers?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
What is union and structure?
What is a scope resolution operator in c?
What is the difference between the = symbol and == symbol?
Which is better malloc or calloc?
What is the scope of an external variable in c?
what will be maximum number of comparisons when number of elements are given?
Explain can the sizeof operator be used to tell the size of an array passed to a function?