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 / ashwini

This gives an error. The error is as below:
error C2105: '++' needs l-value

if we correct the code to printf("%d", i++ + ++i);

We get the answer as 12...

The above printf becomes a statement when it sees the
semicolon. Unary operators have right to left associativity.
So, ++i is evaluated first to 6. Then, i++ is evaluated. i++
contributes 6 to addition and then increments i. So, we get
the answer as 12.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why are all header files not declared in every c program?

1103


i got 75% in all semester am i eligible for your company

2226


What are identifiers c?

1078


Is fortran still used today?

1091


What is the 'named constructor idiom'?

1085


What does sizeof return c?

1062


Explain what is operator promotion?

1086


What is a void pointer in c?

1105


What is the right way to use errno?

1051


What is array of structure in c?

1174


What are the applications of c language?

1078


What is the difference between text and binary i/o?

1050


What is the size of structure pointer in c?

1065


How to explain the final year project as a fresher please answer with sample project

975


What are the basic data types associated with c?

1270