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

#include<stdio.h>
int main()
{
int i=2;
int j=++i + ++i + i++;
printf("%d\n",i);
printf("%d\n",j);
}

Answer Posted / sanjay

i = 5
j = 11
It is because during the first pre-increment "++i" the compiler gets the value from the memory, increments it and stores it in the memory ie now i = 3. During the second pre-increment "++i" the compiler again gets the value from the memory, increments it, (value in the memory was 3) and so the incremented value is stored again in memory ie i = 4. during the post increment, the value from the memory is received and used in the statement ie) (the whole final statement looks like this ->>( 3 + 4 + 4) ) and then value of i is incremented and stored in memory. thus finally the value of i is 5 and j is 11.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain modulus operator.

993


Why void main is used in c?

996


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

1200


Explain what will the preprocessor do for a program?

1003


Describe newline escape sequence with a sample program?

1068


What is boolean in c?

1032


What is the use of extern in c?

1047


What is c standard library?

1145


What does 4d mean in c?

1447


How do you override a defined macro?

1208


what are the advantages of a macro over a function?

1093


Can we compile a program without main() function?

1073


What is spaghetti programming?

1070


What are enumerated types?

1102


Array is an lvalue or not?

1065