In computer programming an Operator is something which performs an operation on variable or values. The operators in C can be mainly classified into:
The assignment Operator = assigns the value of the expression on its right hand side to the variable on the left hand side.
n = 1; /* Assign value 1 to variable n */ p = n; /* Assign value of variable n to variable p */
Arithmetic Operators are used to perform arithmetic operations. Arithmetic operators in C are
Operator | Meaning |
---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus |
++ | Increment |
-- | Decrement |
/* Sum of variables b and c, and subtract by 1;assign result to variable a */ a = b + c - 1; /* Multiply variable m by 2 and divide by k, assign result to variable n */ n = 2 * m / k; /* Modulus of d by 10 - Divide variable d by 10, assign the remainder value to variable c */ c = d % 10; /* Increment the value of variable i by 1 ( i = i + 1 )*/ i++; /* decrement the value of variable i by 1 (i = i - 1) */ i--;
Nothing yet..be the first to share wisdom.