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

gives error
"error C2105: '++' needs l-value"
because it parses above expression in "((i++)++)+i), so in
2nd unary operator it searches for l-value.
If we modify above pgm into following way:-
void main()
{
int i=5;
printf("%d",((i++)+(++i)));
}
it will give answer 12.
because once last pre-unary increment operator is operated,
i is incremented to 6 and 6+6 = 12.
if we put one more print for i's value, it will give i =7.
because first post-increment operator is operated after
first printf statement as follows.
void main()
{
int i=5;
printf("%d",((i++)+(++i)));
printf("%d\n",i); // ===> i =7
}

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a c program to calculate sum of digits till it reduces to a single digit using recursion

3381


What is the use of pointers in C?

1134


What are the advantages of union?

1120


What are the types of data types and explain?

1132


Explain how do you declare an array that will hold more than 64kb of data?

1499


What is wild pointer in c?

1126


What are different types of operators?

1097


Tell us the use of fflush() function in c language?

1201


what is the basis for selection of arrays or pointers as data structure in a program

4344


What are the scope of static variables?

1255


what does static variable mean?

1167


Why is c known as a mother language?

1291


Why cant I open a file by its explicit path?

1086


Why is a semicolon (;) put at the end of every program statement?

1125


What are the types of type specifiers?

1096