tag:blogger.com,1999:blog-2349434231090974738.post1711546784158997154..comments2023-10-24T19:15:52.177+01:00Comments on Advanced C++ with Examples: What is the output of this tricky program?Zahid Ghadialyhttp://www.blogger.com/profile/11618208626682295272noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-2349434231090974738.post-39587463324113859632011-04-24T20:52:14.837+01:002011-04-24T20:52:14.837+01:00My guess is that compiler is making some optimisat...My guess is that compiler is making some optimisation. The gcc compiler is doing something like:<br />2 + 2 + 2 + 2.5 = 8 (int)<br />8 + 8 + 8 + 2.5 = 26 (int).<br /><br />The actual calculations should be<br /><br />8 + 4 + 2 + 2.5 = 16 (int)<br />36 + 18 + 16 + 2.5 = 72 (int)Zahid Ghadialyhttps://www.blogger.com/profile/11618208626682295272noreply@blogger.comtag:blogger.com,1999:blog-2349434231090974738.post-16060141389314000022011-04-24T11:04:07.242+01:002011-04-24T11:04:07.242+01:00a = 26 *f1 = 26 *f2 = 26
for gcca = 26 *f1 = 26 *f2 = 26<br /><br />for gccAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2349434231090974738.post-77998063017228079692011-03-10T03:10:41.901+00:002011-03-10T03:10:41.901+00:00ok sir...i got it
how it comes out to be 72ok sir...i got it<br />how it comes out to be 72vaibhav1302https://www.blogger.com/profile/15945518763312009671noreply@blogger.comtag:blogger.com,1999:blog-2349434231090974738.post-57414302906079919912011-03-10T02:54:23.945+00:002011-03-10T02:54:23.945+00:00This comment has been removed by the author.vaibhav1302https://www.blogger.com/profile/15945518763312009671noreply@blogger.comtag:blogger.com,1999:blog-2349434231090974738.post-7784267986706565112010-02-17T12:46:44.314+00:002010-02-17T12:46:44.314+00:00Do you mean, how did it come as 72? How about you ...Do you mean, how did it come as 72? How about you show me how you calculated and what did you get and I will tell you how it becomes 72.Zahid Ghadialyhttps://www.blogger.com/profile/11618208626682295272noreply@blogger.comtag:blogger.com,1999:blog-2349434231090974738.post-61036783084731872912010-02-17T12:37:55.266+00:002010-02-17T12:37:55.266+00:00how did u do this?????how did u do this?????Anonymousnoreply@blogger.com