Operators in C

Level : Beginner
Mentor: Shailendra Chauhan
Duration : 00:02:00

What are the operators in the C language?

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.

Types of Operators in C

C has a variety of built-in operators categorized by functionality:

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Bitwise Operators
  • Assignment Operators
  • Conditional Operator
  • Miscellaneous Operator

Arithmetic Operators

These operators carry out basic mathematical operations such as addition, subtraction, multiplication, and division. 

Relational Operators

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.

Logical Operators

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.

Bitwise Operators

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.

Assignment Operators

They are used to assign values to variables. The most basic assignment operator is "=".

Conditional Operator

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.

Miscellaneous Operator

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.

Precedence of Operators in C

Self-paced Membership
  • 22+ Video Courses
  • 800+ Hands-On Labs
  • 400+ Quick Notes
  • 55+ Skill Tests
  • 45+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
Accept cookies & close this