View Single Post
  #5   Spotlight this post!  
Unread 12-09-2011, 12:43
Andrew Schreiber Andrew Schreiber is offline
Joining the 900 Meme Team
FRC #0079
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 4,062
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Re: Simply question about C program

I like to think of AND as a multiplication and OR as an addition. The analogy breaks down with negation though.

So you can think of A && B || (C && D) as A * B + (C*D) which is pretty easily solved by plugging 1 in for true and 0 in for false. 1*0+(1*1) = 1 (assuming A = 1, B = 0, C = 1, and D = 1)

I have to rely on tricks like this because I struggle to do boolean stuff for some reason. Figured I'd share the trick.
__________________




.