Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How can I run c program?

1183


What is a program?

1276


Explain the difference between the local variable and global variable in c?

1081


how to capitalise first letter of each word in a given string?

1936


Explain the difference between getch() and getche() in c?

1003


Why is c called a mid-level programming language?

1213


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

1234


What are qualifiers?

1057


Explain built-in function?

1150


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

2033


What are control structures? What are the different types?

1098


How can I sort a linked list?

1055


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......

1896


What is #line used for?

1033


What's a good way to check for "close enough" floating-point equality?

1174