TutorialLab
c programming operators
Home » Courses » C Language Programming Operators

C Language Programming Operators

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:

  1. Arithmetic Operators
  2. Increments and Decrements Operators
  3. Assignment Operators
  4. Logic Operators
  5. Conditional operators etc.

Arithmetic Operators includes following:

  • Addition
  • Subtraction
  • Multiplication
  •  Division

Example of Working of Arithmetic Operators

Output:

a+b=10

a-b=0

a*b=25

a/b=1

remainder when a is divided by b=0

Output : 

2

4

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 :

OperatorExampleSame as
=a=ba=b
+=a+=ba=a+b
-=a-=ba=a-b

and so on division, multiplication and remainder.

Relational operator includes following:

OperatorMeaningExample
!ERROR! unexpected operator '='Equal to5==2
returns false(0)
>greater than5>3
returns true(1)
<less than2<1
return false(0)
!=not equal to5!=4
returns true(1)
>=greater than or equal to5>=3
<=less than or equal to2<=3

 

Example of Logical Operators:

Example operators contains three relations to combine operators.

OperatorMeaningExample
&&Logical Andif c=5 and d=2 then((c==5))&&(d>5));
return false.
||Logical Orif c=5 and d=2 then ((c=5))||(d>5));
return true.
!Logical notif c=5 then, !(c==5);
returns false.

hassan

A Freelancer web developer, graphic designer and own this blog to spread knowledge.My hobby is computer problem's solving and i love to help other in this field.

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.