User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 456,552 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,453 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 1861 | Replies: 3
Reply
Join Date: Jul 2004
Location: India
Posts: 15
Reputation: shalin is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
shalin's Avatar
shalin shalin is offline Offline
Newbie Poster

What will be the O/P & why ?

  #1  
Aug 13th, 2004
Hi all

here is small C program
main()
{
int i=2;
printf("%d\n",++i * ++i * ++i * ++i);
}

it gives o/p 480 why..?

Thanks for u r reply.
shalin
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2004
Posts: 11
Reputation: stg110 is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
stg110 stg110 is offline Offline
Newbie Poster

Re: What will be the O/P & why ?

  #2  
Aug 14th, 2004
it is wrong to do such expression (assign the same variable (i) in a single operation more than onetime) it gives a machine dependent result
Reply With Quote  
Join Date: Aug 2004
Location: India
Posts: 6
Reputation: brnprasad630 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
brnprasad630 brnprasad630 is offline Offline
Newbie Poster

Re: What will be the O/P & why ?

  #3  
Aug 16th, 2004
Actually this kind of problems are compiler dependent. Try in different types of compilers. You will see different answers.
Reply With Quote  
Join Date: Aug 2004
Posts: 2
Reputation: pursottam tiwar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
pursottam tiwar pursottam tiwar is offline Offline
Newbie Poster

Re: What will be the O/P & why ?

  #4  
Aug 16th, 2004
hi shalin
i run ur programme and getting o/p 360...plz check ur programme oncagain
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C Forum

All times are GMT -4. The time now is 5:15 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC