RE: Strange processing!!

Viorel ANUSCA <[email protected]> Tue, 14 Mar 2006 14:26:51 +0100 (CET)
Newsgroups gmane.comp.programming.cppug
Message-ID <[email protected]>
Hi Anuj,
   
  that it is beaucause:
   
   
    –++n increments n before its value is used 
  

   
  and you have: b = x1+x2+x3 = 6+7+8 = 21
   
  Best,
  Viorel
  

anuj gupta <[email protected]> a écrit :
  Hi All,
This is Anuj,an MCA std from India.
I tried the following 2 progs, both resulted in
different outputs. But i don't understand the REASON
behind them. 

1. 
int a=5, b = ++a + ++a + ++a;
printf("%d",b);
OUTPUT :- 21

2.
int a=5, b;
b = ++a + ++a + ++a;
printf("%d",b);
OUTPUT :- 54

Even if i use Macro expansion instead of writing the
whole expression, even then the result is same.
If anyone out there can help me out it'll be a big
help.Thank you.


            
__________________________________________________________ 
Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com




  SPONSORED LINKS 
        Programming languages   C programming language   Computer programming languages 
    
---------------------------------
  YAHOO! GROUPS LINKS 

    
    Visit your group "cppug" on the web.
    
    To unsubscribe from this group, send an email to:
 [email protected]
    
    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

    
---------------------------------
  



		
---------------------------------
 Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.Téléchargez la version beta.

[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/cppug/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/