Top 4 Operators in C Language with Examples

Operator in C programming is a symbol use to perform some operation on variables, operands or with the constant. Some operator required 2 operand to perform operation or Some required single operation. Several operators are there those are, arithmetic operator, assignment, increment , decrement, logical, conditional, comma, size of , bitwise and others.

In this article, I will be sharing different types of Operator in C with examples.


Types of Operators in C Language

An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations. 

C operators can be classified as

1. Arithmetic operators

2. Relational operators

3. Logical operators

4. Assignment operators

5. Increment or Decrement operators

6. Conditional operator

7. Bit wise operators

8. Special operators


ARITHMETIC OPERATORS IN C

All basic arithmetic operators are present in C.

  1. +  add
  2. - subtract
  3. * multiplication
  4. / division
  5. % modulo division(remainder)

An arithmetic operation involving only real operands(or integer operands) is called real arithmetic(or integer arithmetic). If a combination of arithmetic and real is called mixed mode arithmetic. 


RELATIONAL OPERATORS

We often compare two quantities and depending on their relation take certain decisions for that comparison we use relational operators.

  1. < is less than
  2. > is greater than
  3. <= is less than or equal to
  4. >= is greater than or equal to
  5. == is equal to
  6. != is not equal to

LOGICAL OPERATORS

An expression of this kind which combines two or more relational expressions is termed as a logical expressions or a compound relational expression.


It is use to compared value of two expressions depending on their relation. Expression that contain relational operator is called relational expression. Here the value is assign according to true or false value.

  • a.(a>=b) || (b>20)
  • b.(b>a) && (e>b)
  • c. 0(b!=7)

ASSIGNMENT OPERATORS

They are used to assign the result of an expression to a variable. The assignment operator is '='.

A value can be stored in a variable with the use of assignment operator. The assignment operator(=) is used in assignment statement and assignment expression. Operand on the left hand side should be variable and the operand on the right hand side should be variable or constant or any expression. When variable on the left hand side is occur on the right hand side then we can avoid by writing the
compound statement.

For example,

  •  int x= y;
  •  int Sum=x+y+z;

To know rest of operator detail visit: types of Operator in C Programming Notes

Want to Know more So Checkout more such Knowledgeable Article and Comment below for any Queries and more.

Check more posts on Programming and Information related to Coding only at Copy2Run Programs

Thanks for Visiting – Stay Updated with our Site and keep Visiting.

Comments

Popular posts from this blog

Implement Bouncing Ball Animation Using C Graphics

Walking Stickman -Using C graphics

Sine Wave - Using C Graphics