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

What is the full form of getch?

1266


What are global variables and explain how do you declare them?

1095


What is the difference between the local variable and global variable in c?

959


What is keyword with example?

1061


What are keywords c?

1026


Explain how can I write functions that take a variable number of arguments?

1073


write a c program to find the sum of five entered numbers using an array named number

2132


a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

1058


What are the types of operators in c?

1055


What is wild pointer in c with example?

1054


Which is best linux os?

1024


What are actual arguments?

1083


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

1001


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

8038


What is a pointer in c plus plus?

1297