What is the result of logical or relational expression in C?
a) A floating-point number
b) A string
c) An integer (0 or 1)
d) A pointer
Answer:
c) An integer (0 or 1)
Explanation:
In C, the result of a logical or relational expression is an integer value: 0 (representing false) or 1 (representing true). For example, the expression a > b
will return 1 if a
is greater than b
, and 0 otherwise. Logical expressions using operators like &&
(AND), ||
(OR), and !
(NOT) also return either 0 or 1.
Understanding the result of logical and relational expressions is important for controlling program flow and making decisions in C programming.