Question and Answer
Question and Answer
Q Which bit can be used as the sign bit in an integer?
Question and Answer
Q Which bit can be used as the sign bit in an integer?
To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.
What Does x?y:z Mean?
In C, ?: is called the conditional operator, which is the only operator that takes three operands. The general form of the conditional operator is
Using Shift Operators
There are two shift operators in C. The >> operator shifts the bits of an operand to the right; the << operator shifts the bits to the left.
The general forms of the two shift operators are
x >> y
Manipulating Bits
In previous hours, you learned that computer data and files are made of bits (or bytes). There is even an operator in C_the sizeof operator_that can be used to measure the number of bytes for data types.
Everything Is Logical
Now, it's time for you to learn about a new set of operators: logical operators.
There are three logical operators in the C language:
&& The logical AND operator
|| The logical OR operator
To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.
Playing with an Infinite Loop
If you have a for statement like this,
for ( ; ; ){
/* statement block */
}