7.10 — Static local variables

The term static is one of the most confusing terms in the C++ language, in large part because static has different meanings in different contexts. In prior lessons, we covered that global variables have static duration, which means they are created when the program starts and destroyed when the program …

O.2 — Bitwise operators

C++ provides 6 bit manipulation operators, often called operators: Author’s note In the following examples, we will largely be working with 4-bit binary values. This is for the sake of convenience and keeping the examples simple. In actual programs, the number of bits used is based on the size of …

6.7 — Logical operators

While relational (comparison) operators can be used to test whether a particular condition is true or false, they can only test one condition at a time. Often we need to know whether multiple conditions are true simultaneously. For example, to check whether we’ve won the lottery, we have to compare …

6.5 — The comma operator

The allows you to evaluate multiple expressions wherever a single expression is allowed. The comma operator evaluates the left operand, then the right operand, and then returns the result of the right operand. For example: #include <iostream> int main() { int x{ 1 }; int y{ 2 }; std::cout << …