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 can I run c program?
What is a program?
Explain the difference between the local variable and global variable in c?
how to capitalise first letter of each word in a given string?
Explain the difference between getch() and getche() in c?
Why is c called a mid-level programming language?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
What are qualifiers?
Explain built-in function?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
What are control structures? What are the different types?
How can I sort a linked list?
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
What is #line used for?
What's a good way to check for "close enough" floating-point equality?