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
What are reserved words?
If I have a char * variable pointing to the name of a function ..
What is c language used for?
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
Why c is faster than c++?
Explain how do you print an address?
What is the correct code to have following output in c using nested for loop?
What is a program flowchart and how does it help in writing a program?
Hai what is the different types of versions and their differences
When should we use pointers in a c program?
What is double pointer in c?
What are variables and it what way is it different from constants?
Why do we use & in c?
Explain what is the use of a semicolon (;) at the end of every program statement?
Should I learn c before c++?