C Input Question?

Tim Smith tim at callan.UUCP
Sat Mar 9 07:14:06 AEST 1985


In article <7026 at watdaisy.UUCP> ndiamond at watdaisy.UUCP (Norman Diamond) writes:
>> I was reading Creative Computing when I saw the most bogus C programming
>> example.  The author was comparing C to Basic-
>> 	Basic: if A=1 and B=1 goto 104950393040 [:->
>> 	C: if (A==1 & B==1) foobar();
>> Which works, of course, but it was clear from the context that the author
>> thought that '&' and logical AND were identical!!!!  -- Mark Roddy
>
>It doesn't work if A == 1 and B == 3.  It calls foobar when it shouldn't.

Mr. Roddy is correct.  I think Mr. Diamond is forgetting that the range
of the '==' operator is {0,1}.
-- 
Duty Now for the Future
					Tim Smith
			ihnp4!wlbr!callan!tim or ihnp4!cithep!tim



More information about the Comp.lang.c mailing list