what is the output for this question:
main()
{
int i=1;
printf("%d%d%d",i,i++,++i);
}
Answer Posted / rama krishna sidhartha
3,2,2 is the correct output. Because the the associativity
of ++ operator is from right to left.
since i=1
++i = 2(since it is a preincrement operator it is
incremented before printing the value)
i++ = 2(since it is a postincrement operator it is
incremented after printing the value)
i = 3
so it is displayed like 3,2,2.
Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
How would you rename a function in C?
What is volatile variable in c?
What is methods in c?
What are multibyte characters?
Explain heap and queue.
How can I implement a delay, or time a users response, with sub-second resolution?
What is extern storage class in c?
How to delete a node from linked list w/o using collectons?
If you know then define #pragma?
What is header file in c?
Explain what happens if you free a pointer twice?
How can I avoid the abort, retry, fail messages?
What is bubble sort technique in c?
What is the difference between volatile and const volatile?
Why is main function so important?