Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

True and False for && logic and || Logic table

Tags:

c

truthtable

Table true/false for C Language

I have heard of a table true false for C Language for and && or || is kind of the mathematics one for which they say if true+true=true and false+true=false

I'm just kind of confuse on this and I tried to do the research but couldn't find any of the table

I just wish to have this table for my notes since I will do more in C language

if someone could bring me to the site or resources where they explain about this more


I've edited my original question to make it a note for my own study. Thanks @thiton for the great references and the rest for an awesome answer/resources.

Logical AND (&&)

false && false: false

false && true: false

true && false: false

true && true: true

Logical OR (||)

false || false: false

false || true: true

true || false: true

true || true: true

Logical NOT (!)

!false: true

!true: false

like image 450
Ali Avatar asked Sep 28 '11 13:09

Ali


People also ask

Is true || false?

As we can see, the result is always true except for the case when both operands are false . If an operand is not a boolean, it's converted to a boolean for the evaluation. Most of the time, OR || is used in an if statement to test if any of the given conditions is true .

What is output of true and false?

therefore In Boolean algebra True + False=1+0=1.

What is the value of true || false?

Whenever an integer value is tested to see whether it is true of false, 0 is considered to be false and all other integers are considered be true. Operators !, && and || always yield either 0 or 1. For example, expression 3 && −2 yields true.

What does false and true mean?

What does true or false mean? True or false is variously said of something that must be considered as correct (true) or incorrect (false).


1 Answers

You probably mean a truth table for the boolean operators, which displays the result of the usual boolean operations (&&, ||). This table is not language-specific, but can be found e.g. here.

like image 103
thiton Avatar answered Sep 20 '22 05:09

thiton