C Language Programming Operators
Programming Operators are the symbol which operates on value or a variable. For example: + is a operator to perform addition.
C programming language has wide range of operators to perform various operations. For better understanding of operators, these operators can be classified as :
Different Operators in C programming:
- Arithmetic Operators
- Increments and Decrements Operators
- Assignment Operators
- Logic Operators
- Conditional operators etc.
Arithmetic Operators includes following:
Example of Working of Arithmetic Operators
printf("remainder when is divided by b=%d\n",x);
remainder when a is divided by b=0
printf("%d\n,c++); //this statement display 2 then, only c incremented by 1 to 3.
printf("%d",++c); //this statement increments 1 to c then, only c is displayed.
Assignment Operator :
The most common assignment operator is =. This operator assigns the value in right side to the left side.
- Var=3 //3 is assigned to var
- a=c; //value of c is assigned to a.
- 5=c; //Error! 5 is constant
Assignment Operators includes following :
and so on division, multiplication and remainder.
Relational operator includes following:
|!ERROR! unexpected operator '='||Equal to||5==2
|!=||not equal to||5!=4
|>=||greater than or equal to||5>=3
|<=||less than or equal to||2<=3|
Example of Logical Operators:
Example operators contains three relations to combine operators.
|&&||Logical And||if c=5 and d=2 then((c==5))&&(d>5));
|||||Logical Or||if c=5 and d=2 then ((c=5))||(d>5));
|!||Logical not||if c=5 then, !(c==5);