AsegGasiaBlog

C Programming - Operators - C Shorthand

C Shorthand

C has a special shorthand that simplifies coding of certain type of assignment.

For Example

a = a + 2;

can be written as :

a += 2;

Shorthand works for akk binary operators in C.

Syntax :

variable operator = variable / constant / expression

Operators are listed below :

OperatorsExampleMeaning
+=a+=2a=a+2
-=a-=2a=a-2
*=a*=2a=a*2
/=a/=2a=a/2
%=a%=2a=a%2
&&=a&&=2a=a&&2
||=a||=2a=a||2

Popular Posts