Welcome to this article, here in this article we will discuss what are **operators in c **programming.

And the various types of operators available in c programming.

But before the definition of operators we have to gain some knowledge about what is operator and expression in c? so what is an expression?

Well, an expression is a valid combination of operators and operands on evaluation it yields a result.

For example 7+7 ,here 7 and 7 are operands and the + symbol is operator .

Now lets dicuss about the what is c operators? and its types.

Table of Contents

## What is an operator in c?

Well if we define about operator what is an operator? then it will be one line definition.

Generally, the operator is a symbol that performs an operation on the provided operand or operands.

In the upper example + is an operator which performs an addition operation of the given operands 7+7 and gives us a result of 14.

So what is an operand? generally, operands is a value on which an operator performs an operation.

In any programming, language operators are broadly categorize into three sections such as-

- Unary operators(It usually accepts only one operand)
- Binary operators(it accepts two operands)
- ternary operators(it accepts three operands)

## What are the different types of operators in c programming?

C language provides us a lot of operators to perform separate operations such as- arithmetic operations, logical operation, comparison operation, etc.

It is not possible to remember all the operators easily therefore I give you a shortcut in which you can easily remember the types of operators, the shortcut is LARA BICS.

Here l stands for logical operators, a stands for arithmetic operators,r stands for relational operators, a stands for assignment operators, b stands for bitwise operators, I stands for increment and decrement operators,c stands for conditional operators and at lasts stands for special operators.

Now lets us discuss about the types of operators.

## Arithmetic operators in c programming:

In the c programming language, there are mainly 5 arithmetic operators are available which are the-

- Addition operator(+)= This operator is mainly used to sum two or more numbers.
- Substruction operator(-)=This is used to display the difference between two numbers.
- Multiplication operator(*)=This is used to bring the multiply of the two numbers
- the division operator(/)= It brings us the quotation of a division operation

- Modulus operator(%)=It is used to give us the remainder.

We will discuss all the arithmetic operators in detail in later articles.

## Relational operators in c :

In c programming language or in any programming language relational operators are also known as comparison operators.

And these are mainly used to find the relationship between two values or compare the relationship between two values.

They always yield results either 0 or 1.

Here 0 indicates the false and any non-zero statement indicates true.

There are normally 6 relational **operators in c** programming language and they are.

1.less than(<)

2.Greater than(>)

3.less than or equal to(<=)

4.greater than or equal to(>=)

5.Equal to(==)

6.not equal to(!=)

## Logical operators in c programming:

Logical operators are also known as logical connectives. They are used to connect one or more relational expressions or conditions.

They accept boolean operands and on evaluation, they yield the result either (1) or (0).

There are three different logical operators available such as-

1. logical and operator

2.logical or operator

3.logical not operator

**Logical and operator:**

Pair of ampersands symbols indicates (&&) logical and operator.

The logical and the operator says that if both LHS and RHS are true then the result will be true, in all the cases the result will be false.

LHS | RHS | LHS && RHS |

true | true | true |

true | false | false |

false | true | false |

false | false | false |

**Logical or operator:**

Pair of pipe line symbols indicates logical or operator.

LHS | RHS | LHS || RHS |

true | true | true |

true | false | true |

false | true | true |

false | false | false |

**Logical not operator:**

The exclamation mark symbol indicates the logical not operator.

LHS | !RHS |

true | false |

false | true |

## Assignment operators in c programming :

In any programming language, assignment operators are used to assigning a value to a variable or a constant.

There are many types of assignment operators are available in c programming.

And we can categorized the assignment operators in two category

- AA(arithmatic assignment) += -= *= /= %=

These are known as arithmetic assignment operators and these are known as arithmetic assignment operators.

Because before the assignment operator we use the arithmetic signs.

- BA(bitwise assignment)

&=

|=

^=

<<=

>>=

These are known as bitwise assignment operators.

Because before the assignment operator we use the bitwise signs.

## Bitwise operator in c programming:

This operators are use to perform operation on bit 0s and 1s.

These operators convert the given decimal numbers to their binary equivalent numbers.

And then they convert and return the result of the operation as a decimal number back.

There are normally six types of bitwise operators are available in c programing language and these are-

**Bitwise and operator(&):**

If both LHS and RHS bits are 1 then the result will be 1, in all other cases result will become 0.

**Bitwise or operator(|):**

If both LHS and RHS bits are0 then the result will be 0, in all other cases result will be 1.

**Bitwise exclusive or operator(^):**

If both LHS and RHS are the same bits then the result will be 0, otherwise, the result will be 1.

**Bitwise complement operator(~):**

To complement a number add 1 to it and change the sign.

**Bitwise left shift operator(<<):**

Shifts the bits of the first number to the left by a number of positions indicated by the second number.

**Bitwise right shift operator(>>):**

Shifts the bits of the first number to the right by the number of positions indicates by the second number.

## Conditional operator in c :

The (?:) actually indicates the conditional operators.

And it is a kind of ternary operator and it accepts three operands to work.

Such as (operand 1)? operand 2: operand 3;

**Where:**

Operand 1 : it must be a condition

Operand2:value 1//true part

Operand3:value2//false part.

If you are unable to understand then demonstrate the condition here. In conditional operator we three operands.

One is the condition and which is the first part if the condition becomes true then it goes to the next part.

This is our second part and it is also the true part of the condition, the condition.

And the true part are generally divided by the question mark sign.

And if the condition becomes false it goes to the next part which is generally the else part of our condition.

The two parts are divided with the colon sign.

## Special operators in c :

We already mention all the important operators available on the c programming.

But besides these operators, there are some special kinds of operators as well which are known as special operators.

These operators are –

**Sizeof operator:**

It is a kind of special operator and it is used to get the size of a given operand in bytes.

**Comma operator(,):**

It is used for the group related expression together.

**Address of(or referencing) operator(&):**

It is used to get the address (or reference) of a variable, a constant, or some memory location.

**Dereferencing (or pointer) operator(*):**

It is used to create a variable; which holds the address of another memory location.

It is used to create a pointer to a variable, a constant, or some memory location.

**Double dereferencing (or double pointer) operator(**):**

It is used to create a pointer; which holds the address of another pointer variable.

It is used to create a pointer to a pointer variable.

**Member access operators:**

Dot and arrow operators.

**Dot operator(.):**

It is used to access members of a structure or an union directly.

**Arrow operator(->):**

It is used to access members of a structure or a union through a pointer variable.

**Also read**

Unary operator in c programming language | |

Best editors for c programming | |

Printf in c programming | |

C program syntax | |

Best youtube channel to learn c programming |

**Conclusion:**

In this article, we discussed what are **operators in c** programming and what types of operators are available on the c programming language.

But besides these operators, there are some other types of operators are available.

But don’t worry too much because in later articles we will discuss these types of operators with their examples and also discussed their uses.

So keep following our website for these kinds of informational articles.