Re: Strange processing!!

Santhosh Raj <[email protected]> Tue, 14 Mar 2006 13:49:54 +0000 (GMT)
Newsgroups gmane.comp.programming.cppug
Message-ID <[email protected]>
hi anuj
this prob is existent vth C language
I think uve tried it on different compilers and C does
not specify the associativity for pre or post
incr/decr operators and in some compilers it may also
give an error about having +++ as an inexistent
operator

--- anuj gupta <[email protected]> wrote:


---------------------------------
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.

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








		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com


 
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/