# What is true or false?

1. Dec 18, 2011

### vorcil

1. The problem statement, all variables and given/known data

in this statement

if (iarray < 0 && *isigned)

How do I evaluate that

the code is in c

isigned is either 0 or 1

does it mean that for each value in the array that is less than 0 AND for each value in the array that is less than isigned

or does it mean for each value in the array AND a some other statement

&& isigned (where isigned is either 0 or 1)

what does it mean?
2. Relevant equations

3. The attempt at a solution

2. Dec 18, 2011

### LCKurtz

I would think isigned must be a pointer and *isigned is the value stored at the address pointed to. So it isn't isigned which is 0 or 1, it is that value at that address that is. The && operator performs a logical AND interpreting that 1 or 0 as TRUE or FALSE.

3. Dec 18, 2011

### vorcil

Cheers matey potatey

4. Dec 18, 2011

### Staff: Mentor

This is not a looping statement. This if statement looks at only one element in the array.

The && is performed last, after iarray < 0 is evaluated. So it's equal to:
if ((iarray < 0) && *isigned)

Also, unless the first condition evaluates as true, then whatever isigned points to is not considered. So isigned need not point anywhere, not until iarray < 0 becomes true (at least as far as evaluation of this statement is concerned).

Last edited: Dec 19, 2011
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook