what is the output for this question:
main()
{
int i=1;
printf("%d%d%d",i,i++,++i);
}

Answer Posted / sumalatha

Ans is 2 2 2
because in printf assosiativity is from left to right
first pre increments i that becomes 2 next post increment
is done after printf stmt so prints 2 again, then simple
print i i.e 2again
last post increnent which i becomes 3 but that is done
after printf stmt

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is wrong in this statement?

637


write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.

1580


What does typeof return in c?

640


What is a structure and why it is used?

623


What is union and structure?

576






can anyone please tell about the nested interrupts?

1678


How can I copy just a portion of a string?

820


What is a pointer value and address in c?

636


What are the valid places to have keyword “break”?

653


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1533


What are all different types of pointers in c?

581


Why c is called a middle level language?

635


What is main () in c language?

601


How can I write a function that takes a format string and a variable number of arguments?

607


Tell us bitwise shift operators?

601