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
Explain what is dynamic data structure?
Explain what are its uses in c programming?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
What is pointer and structure in c?
When should I declare a function?
Can two or more operators such as and be combined in a single line of program code?
Compare array data type to pointer data type
What is the size of structure in c?
Where we use clrscr in c?
What is structure packing in c?
How do you override a defined macro?
What is a global variable in c?
What is formal argument?
Why is sizeof () an operator and not a function?
what will be the output for the following main() { printf("hi" "hello"); }