avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Re: If statement with Negative number problems


From: Stefan Wimmer
Subject: [avr-gcc-list] Re: If statement with Negative number problems
Date: Mon, 28 May 2001 14:36:00 +0200

Dale Seaburg <address@hidden> wrote:

> Basically, when I test a variable for a value less than zero, I get an
> incorrect (it appears to *me* to be incorrect) result.  The program is
> below, and is a snippet of the much larger program that has the
> problem.  The LEDs on the STK200 show a 4 as the result, 
> rather than a 1 as would be expected.

Hello Dale,

seems you have to look faster! :)

Your program is putting out a "1" in the first comparison (looking for <0)
which is shortly after overwritten with a "4" in the final "else" part (i.e.
not ==0 and not >0) of your second comparison.

HTH,
Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]