Operators and Expressions in STL
The next thing you should know about is operators. Operators are used to manipulate data and is a part of almost any programming language. This leads us to the second thing you should know about – expressions. Just like operators, expressions are a crucial part of programming languages. An expression is a construct that, when evaluated, yields a value.This means that when the compiler compiles an expression, it will evaluate the expression and replace the statement with the result. Take this example with the two variables A and B. A contains the value 10 and B contains 8.
The result of this expression is 18. So instead of A+B, the compiler will put in the value 18. An expression are composed of operators and operands. So what are operators and operands? Since, you just saw an example of an expression, you just saw both an operator and two operands. A and B are both operands and the + is an operator. Remember that operators are used to manipulate data. That is exactly what the + is doing. It is taking the value of the variable A and adding it to the value in B. The + is also called the addition operator because the operation is addition.