C Shorthand - Devbhoomi

FREE JOB ALERT & ONLINE TUTORIALS

Hot

Post Top Ad

Sunday 5 November 2017

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

No comments:

Post a Comment

Post Top Ad