An operator in C is defined as a symbol that allows us to execute certain mathematical, relational, bitwise, conditional, or logical calculations on values or variables. The values and variables used with operators are referred to as operands. So, operators are symbols that perform operations on operands.
C has a variety of built-in operators categorized by functionality:
These operators carry out basic mathematical operations such as addition, subtraction, multiplication, and division.
They are also called Comparison Operators. They compare the values of the two operands. The comparison produces one of two results: true or false. If the comparison is successful, it returns 1; if the comparison fails, it returns 0. These are referred to as boolean values.
They are used for combining multiple conditions or limitations. It results in 0 or 1 based on whether the expression is true or false. If the result is true, it returns 1, otherwise it returns 0. Logical operators are used to make decisions and create looping statements.
These operators work with individual bits. The operands first get converted into bits, such as 0 or 1, before the calculation is done on them.
They are used to assign values to variables. The most basic assignment operator is "=".
This is also known as a ternary operator. It works with three operands. The ternary operator is used to execute one group of statements when the test expression is true and another set of statements when it is false.
Commas are used to separate expressions in a statement and are a component of C's miscellaneous operator (,). The value of the rightmost expression is returned after each expression is evaluated from left to right.