
logical operators
ok
now here's my confusion logical operators
Code:
int i, j,k;
i=10; j=1; k=2;
printf("%d", !i < j); //what does !i mean??? //
printf("%d", !!i < !j); // what does !!i mean ??? //
printf("%d", i && j  k); // what is the result asking for ?? //
printf("%d", i < j  k); // again, there's no if clause asking for comparison, so what does the result ask for?? //
I compiled code and ran and all the results were 1.
Is that a 1 meaning TRUE for the relation between 2 values??
I am just so confused on the use of these logical operators.
Gimme loops or ifelse statements anytime!!
:(

explained recently on the c++ board. have a look for a thread called AND,OR and NOT or something like that.

CLARIFICATION PLEASE
Sorry, Stone, read the post on AND , OR , & NOT and don't get it.
Please help.
I guess what is confusing me is using < or > with AND OR NOT
and getting an evaluation.
So.........
int i, j,k;
i=10; j=1; k=2;
printf("%d", !i < j);
Is this saying, NOT i < j
thus NOT 10 < 1
thus TRUE
yields TRUE and TRUE is a result value of 1 ???
printf("%d", !!i < !j);
Is this saying, NOT(NOT i) < NOT j
thus NOT (NOT 10) < NOT 1
thus 10 < NOT 1
thus TRUE
yields TRUE, thus value of 1 ????
printf("%d", i && j  k);
Is this saying, (i AND j) OR k
thus (10 AND 1) OR 2
thus TRUE OR TRUE
yields TRUE, thus value of 1 ????
printf("%d", i < j  k);
Is this saying, (i < j) OR k
thus (10 < 1) OR k
thus FALSE OR TRUE
yields TRUE, thus value of 1 ????s

Priority of operators, Inequality comes before logical AND (&&) logical OR () and although my text Im referencing from I pretty sure NOT comes before logical AND. Now referring back to your first post,
i=10; j=1; k=2;
printf("%d", !i < j);
It tests ( i < j ) or (10 < 1)
this is no so it returns zero
then NOT Zero is one
so it prints one.
*************************************
printf("%d", !!i < !j);
!!i is the same as i
Not a 100% sure on what !j does but i think because j == 1
"j" now becomes zero. So the whole thing becomes
i<!j == 10<0 == 0
*****************************
try other values and play around with the logical operators. If you need more help post a reply

I made a slight error
In fact, NOT (!) comes before inequalities (<, >, <= etc) it is a unary operator.