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

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

} output is 10

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

}output is 12
why it is so? give appropiate reason....

Answer Posted / sudarsan.tuku@gmail.com

1>On the 1st que the ans. is 12
bcz perform the pre increment 1st then add them.
After the pre increment the value of i becomes 6 and
then it perform the add operation i.e. i+i=6+6=12.

2>output is 10
It 1st perform the pre operation but there is no pre
operation in the que.
2ndly it perform the operation i.e i+i=5+5=10.
3rdly it perform post operation i.e i++ so i becomes 6.
but here the output is 10.

Is This Answer Correct ?    16 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is c procedural or functional?

1039


Can we access array using pointer in c language?

1096


how we can make 3d venturing graphics on outer interface

4835


What is header file definition?

1087


In a switch statement, what will happen if a break statement is omitted?

1069


Define circular linked list.

1036


What is the difference between near, far and huge pointers?

1099


program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

3095


What is union and structure?

1127


What is a scope resolution operator in c?

1279


What is the difference between the = symbol and == symbol?

1126


Which is better malloc or calloc?

1106


What is the scope of an external variable in c?

1050


what will be maximum number of comparisons when number of elements are given?

1909


Explain can the sizeof operator be used to tell the size of an array passed to a function?

1078