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

What are the different types of constants?

1129


Explain what are multidimensional arrays?

1122


What is c language used for?

1027


Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?

1057


Why & is used in scanf in c?

1146


What is function what are the types of function?

1057


Why is sizeof () an operator and not a function?

1091


Explain what is page thrashing?

1160


why we wont use '&' sing in aceesing the string using scanf

2427


Why isnt there a numbered, multi-level break statement to break out

1099


Difference between pass by reference and pass by value?

1210


Why is c called c not d or e?

1146


what is the different bitween abap and abap-hr?

2426


What are the properties of union in c?

1111


What will be the outcome of the following conditional statement if the value of variable s is 10?

1370