Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 May 1997 20:14:06 -0700 (PDT)
From:      Alex Belits <abelits@phobos.illtel.denver.co.us>
To:        Steve Howe <un_x@anchorage.net>
Cc:        freebsd-hackers <hackers@FreeBSD.ORG>
Subject:   Re: cc/gcc
Message-ID:  <Pine.LNX.3.95.970529200737.2788B-100000@phobos.illtel.denver.co.us>
In-Reply-To: <Pine.BSF.3.95q.970529180401.8774A-100000@aak.anchorage.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 29 May 1997, Steve Howe wrote:

with cc/gcc, i get outputs of "1" and "0" respectively.  why?

> unsigned char a, b, c;
> 
>      a = 1; b = 1; c = 0;
>      c = a == b ==  1  ?  1  :  0 ; printf(" %i\n", c);

           1 == 1 ==  1
              1   ==  1
                   1

>      a='1'; b='1'; c = 0;
>      c = a == b == '1' ? '1' : '0'; printf(" %c\n", c);
           '1'=='1'=='1' 
               1  == '1'
                   0 
--
Alex





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.3.95.970529200737.2788B-100000>