## C Operators

Operators: Operators are the foundations of any programming language. It is a symbol that inform the compiler to take a particular action or operation . C language has a rich build-in operators . It is provide following operators.

#### Arithmetic Operator:

This Opreators used to perform some Arithmetic operation between two operand. Lets consider a =20 and b=10 are two variables or operand. See the following table:

Operator Description Example
+ To add to variables a+b is 30
- To substruct from one to another a-b is 10
* Multiplies both operands. a*b is 300
/ Divide both opreand a/b is 2
% Modulus Opreator It used to find the remainder a%b is 0
++ Increment operator.It use to increment variable value by 1 a++ is 21, b++ is 11
-- Decrement operator.It use to decrement variable value by 1 a-- is 19, b-- is 9
##### See the following example:
``````#include<stdio.h>
int main(){
int a = 20, b = 10;
printf("Result= %d",a+b);
printf("Result= %d",a-b);
printf("Result= %d",a*b);
printf("Result= %d",a/b);
printf("Result= %d",a%b);
printf("Result= %d",a++);
printf("Result= %d",b--);
return 0;
}``````

##### Output:
``````Result= 30
Result= 10
Result= 200
Result= 2
Result= 0
Result= 21
Result= 9

``````

#### Relational Operators:

This Opreators used to find relation between two variable.It return boolean value like ture or false . Lets consider a=20 and b=10 are two variables. See the following. table:

Operator Description Example
== Equal to opearator.If two variable is equal to each other it return true otherwise false a == b return false.
!= Not Equal to opearator.If two variable is not equal to each other it return true otherwise false. a != b return true
> Greater than operator.If a>b is satisfied then it return true otherwise return false. a > b return true.
< Less than operator.If a < b is satisfied then it return true otherwise return false. a < b return false.
>= Greater then equal to operator. If a > b or a == b is satisfied then it return true otherwise return false. a >= b return ture
<= Greater then equal to operator. If a < b or a == b is satisfied then it return true otherwise return false. a <= b return false

#### Logical Operators:

This Opreators used to setup a relation between two or more things.It is also return boolean value.Assume a=1, b=0.

Operator Description Example
&& Called Logical AND operator. If both the operands are non-zero, then the condition becomes true. a&&b is false
|| Called Logical OR Operator. If any of the two operands is non-zero, then the condition becomes true. (A || B) is true
! Called Logical NOT Operator. It is used to reverse the logical state of its operand. If a condition is true, then Logical NOT operator will make it false. !(A || B) is false

#### Assignment Operators:

Following these operators supported by C language.Assume that a is 6,b is4,c is 0.

Operator Description Example
= This is used for insert value in a variable c = a+b so c is 10
+= a+=b is same as a=a+b a+=b then a is 10
-= a-=b is same as a=a-b a-=b then a is 2
*= a*=b is same as a=a*b a*=b then a is 24
/= a/=b is same as a=a/b a/=b then a is 1.5
%= a%=b is same as a=a%b a%=b then a is 2

#### Bitwise Operators:

Following these operators supported by C language.Assume .

Operator Description
& This is used to perform binary AND operation between two or more operands
| This is used to perform binary OR operation between two or more operands
^ This is used to perform binary XOR operation between two or more operands
<< This is used to perform binary left shift operation between two or more operands
>> This is used to perform binary Right shift operation between two or more operands
Best way of learing

Self learing is the best learing in the world. Discover yourself first then will get what you are And what you want to do .It will push you for self learing.

Why you need to learn coding?

Coding will play a vital role in one's life . It will help to open a new window of thinking . You can think better way than past . It helps to organise all the thing in better way .