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

What are reserved words?

1161


If I have a char * variable pointing to the name of a function ..

1235


What is c language used for?

1033


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

2135


Why c is faster than c++?

1093


Explain how do you print an address?

1207


What is the correct code to have following output in c using nested for loop?

1125


What is a program flowchart and how does it help in writing a program?

1195


Hai what is the different types of versions and their differences

1978


When should we use pointers in a c program?

1201


What is double pointer in c?

1091


What are variables and it what way is it different from constants?

1288


Why do we use & in c?

1052


Explain what is the use of a semicolon (;) at the end of every program statement?

1262


Should I learn c before c++?

1299