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 is #define used for in c?
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
Why is c still so popular?
Define the scope of static variables.
Simplify the program segment if X = B then C ← true else C ← false
What is context in c?
What is memcpy() function?
What is "Duff's Device"?
What is a buffer in c?
Is c compiled or interpreted?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
When should you use a type cast?
Tell me what are bitwise shift operators?
Using which language Test cases are added in .ptu file of RTRT unit testing???
What are the basic data types associated with c?