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

void main()
{
int i=5;
printf("%d",i+++++i);
}

Answer Posted / jaroosh

This is a very interesting issue, to solve this, first you
have to note an interesting thing about pre and
postincrementation operators :
a) postincrementation operator instantly MAKES variable an
RVALUE in expression, this is because postincrement operator
doesnt keep track of how many postincrements were made so it
is NOT cumulative (ie u can only use one postincrementation
for variable)
b) preincrementational operator first increments variable
and THEN uses it in expression so there is no need to keep
track of how many preincrementations were made thus
preincrement is cumulative.
Following lines make the point :
i++ = 1; //WRONG! i++ becomes RVALUE,you cannot assign to it
++i = 1; //OK! you first incremented and then assigned.
and thus :
i++++; //WRONG! (i++) is RVALUE so you cannot (RVALUE)++
++++i; //OK! ++(++i)
Now, since postfic ++ has the higher precedence, :
i+++++i
is treaded like :
(i++)++ + i
which will throw compiler error.
i++ + ++i
is however fine, so as
i+ ++++i

This issue might be compiler specific, Im not sure.

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How are Structure passing and returning implemented by the complier?

1176


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1996


What are enums in c?

1214


What are nested functions in c?

1034


Describe static function with its usage?

1219


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

1176


Can two or more operators such as and be combined in a single line of program code?

1377


How do you do dynamic memory allocation in C applications?

1093


Explain zero based addressing.

1042


What is the use of structure padding in c?

1080


what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)

2418


Is null always defined as 0(zero)?

1121


How many types of sorting are there in c?

1062


`write a program to display the recomended action depends on a color of trafic light using nested if statments

2139


What is the meaning of 2d in c?

1131