Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!felix!arcturus!evil From: evil@arcturus.UUCP (Wade Guthrie) Newsgroups: comp.lang.c Subject: Re: value of TRUE??? Summary: TRUE is non-zero Keywords: TRUE, if(), another nonzero value Message-ID: <3863@arcturus> Date: 8 Mar 89 20:26:42 GMT References: <987@infmx.UUCP> Distribution: usa Organization: Rockwell International, Anaheim, CA Lines: 43 In article <987@infmx.UUCP>, kevinf@infmx.UUCP (Kevin Franden) writes: > Hi, I hope someone out there in netland can decide a bet > I have with a colleague. Strictly no sweatski -- what kinda bux are we talking about here? > given: :The if() statement will evaluate to true provided that > the argument does not evaluate to 0. (ie a=3; if (a)...) So far, so good. . . > Is then the value of true any nonzero integer? Strictly speaking, yes. (see recent net flamewarz) > What does if (a=3) evaluate to? Well, a=3 is an expression (i.e., it evaluates to a value). In the event of 'a' being declared as an integer variable (I don't want to get into the implications if it's not), then it is an *integer* expression. Assigning a value to a variable causes the expression to evaluate to the value being assigned to the variable -- so, the expression a=3 evaluates to 3. Hence: if(a=3) { /* this will always be executed */ . . . } else { /* this will never be executed */ . . . } Wade Guthrie evil@arcturus.UUCP Rockwell International Anaheim, CA (Rockwell doesn't necessarily believe / stand by what I'm saying; how could they when *I* don't even know what I'm talking about???)