Operators in C

Operators in C

C language supports a rich set of built-in operators. An operator is a symbol that tells the compiler to perform a certain mathematical or logical manipulation. Operators are used in programs to manipulate data and variables.

* These C operators join individual constants and variables to form expressions.
* Operators, functions, constants, and variables are combined together to form expressions.
* Consider the expression A + B * 5. where, +, * are operators, A, B are variables, 5 is constant and A + B * 5 is an expression.

C operators can be classified into the following types:

  • Arithmetic Operators
  • Assignment Operator
  • Logical operators
  • Relational operators
  • Increment and Decrement Operator
  • Conditional Operator/ ternary operator / ?: Operator
  • sizeof()
  • comma operator
  • typedef statement
  • Constant variable
  • Enumeration (enum)
  • Type conversion/Type casting

Types of OperatorsDescription
Arithmetic operatorsThese are used to perform mathematical calculations like addition, subtraction, multiplication, division and modulus
Assignment operatorsThese are used to assign the values for the variables in C programs.
Relational operatorsThese operators are used to compare the value of two variables.
Logical operatorsThese operators are used to perform logical operations on the given two variables.
Bit wise operatorsThese operators are used to perform bit operations on given two variables.
Conditional (ternary) operatorsConditional operators return one value if the condition is true and returns another value is the condition is false.
Increment/decrement operatorsThese operators are used to either increase or decrease the value of the variable by one.

Special operators

Types of OperatorsDescription
sizeof()This helps us to find the size of a data type or a variable
comma operatorUsed while declaring variable and technical questions
typedef statementGives a user-defined name to an existing data type
Constant variableto declare constant and use them
Enumeration (enum)
Type conversion / Typecasting