Logical Operators & Assignment Operators in C Language

Views: 19   

Logical Operators

C Language provides following three logical operators

Operator Description
&& Logical and
Logical or
! Logical not

Assignment Operators

= is the Assignment operator in C Language, using this you can assign a value to a variable like following.

int age = 20;

Shorthand assignment operators

a = a + b; can also be written as a += b; These type of assignment operators are called as shorthand assignment operators.
Following is the full list of short hand assignment operators you can use.

Using normal assignment operator Using shorthand assignment operator
a = a + b a += b
a = a - b a -= b
a = a * b a *= b
a = a / b a /= b
a = a % b a %= b
On By