Header Ads Widget

Assignment Operator


Value can be stored in a variable with the use of assignment operator. C uses single equal sign to indicate assignment. Operand on the left hand side of assignment operator should be a variable. 
                  x=5 ;
We can assign same value to the many variables by using multiple assignments in a single statement.
                  a = b = 9 ;
Consider    x = x + 5 ;
here same variable appears on both sides of assignment operator. We can avoid writing the variable twice by compound assignment. We can write it as-
                   x += 5 ;

Post a Comment

0 Comments