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

Why is it important to memset a variable, immediately after allocating memory to it ?

2031


Write a program to implement queue.

1088


Is there any data type in c with variable size?

1061


Is c pass by value or reference?

1014


What are the functions to open and close the file in c language?

1010


What does == mean in texting?

1250


How can I insert or delete a line (or record) in the middle of a file?

994


Can we initialize extern variable in c?

1102


What is pass by reference in functions?

810


How do you determine a file’s attributes?

1045


What are predefined functions in c?

1052


In C programming, how do you insert quote characters (‘ and “) into the output screen?

1499


what are the advantages of a macro over a function?

1118


why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above

1094


How are pointers declared in c?

1023