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 is #define used for in c?

1050


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.

2319


Why is c still so popular?

1029


Define the scope of static variables.

1113


Simplify the program segment if X = B then C ← true else C ← false

2994


What is context in c?

910


What is memcpy() function?

1099


What is "Duff's Device"?

1152


What is a buffer in c?

989


Is c compiled or interpreted?

1175


my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?

1581


When should you use a type cast?

1109


Tell me what are bitwise shift operators?

1121


Using which language Test cases are added in .ptu file of RTRT unit testing???

4262


What are the basic data types associated with c?

1258