Professional Documents
Culture Documents
Hour 8 Using Conditional Operators
Hour 8 Using Conditional Operators
Hour 8 Using Conditional Operators
Using Conditional
Operators
Measuring Data Sizes
The sizeof Operator
You can measure the data type size by
using the sizeof operator provided by C.
Example:
size = sizeof(int);
Measuring Data Sizes
Measuring Data Sizes
Everything Is Logical
The Logical Operators
There are three logical operators in the C
language:
&& The logical AND operator
|| The logical OR operator
! The logical NEGATION operator
Everything Is Logical
The Logical Operators
The logical AND and logical OR
operators, are binary operators; that
is, they both take two operands (one to
the left and one to the right of the
operator).
The logical negation operator (!) is a
unary operator; that is, it only takes one
operand (the expression to its right).
Everything Is Logical
The Logical AND Operator (&&)
A general format of the logical AND
operator is:
exp1 || exp2
! expression