In this tutorial I will explain the operators in detail with examples.
OPERATORS
Operators in C language can be defined as symbols that helps us to perform specific mathematical and logical computations on operands.
For Example + is an operator to perform addition.
C has wide range of operators to perform various operations.
_{}^{}
1)ARTHIMETIC OPERATORS:
An arithmetic operators performs mathematical operations such as addition, subtraction, division and multiplication on numerical values._{}^{}
_{}^{}
_{}^{}
OPERATORS
Operators in C language can be defined as symbols that helps us to perform specific mathematical and logical computations on operands.
For Example + is an operator to perform addition.
C has wide range of operators to perform various operations.
_{}^{}
1)ARTHIMETIC OPERATORS:
An arithmetic operators performs mathematical operations such as addition, subtraction, division and multiplication on numerical values._{}^{}
Arithmetic operator are of two types namely Binary which operates on two operands and unary operates on single operand.
i)BINARY OPERATORS
Assignment (‘=’): used to assign Lvalue (lefthandside value) to Rvalue (righthandside value). for example, c = a+b;
Addition (‘+’): used to adds two operands or variables or numerical values. For example, c=a+b.
Subtraction (‘’): The minus operator used to subtract two operands. For example, c=ab.
Multiplication (‘*’): Used to multiply two operands. For example, c=a*b.
Division (‘/’): divides the first operand ‘a’ by the second operand ‘b’. For example, c=a/b.
Modulus (‘%’): Return the remainder when first operand is divided by the second. For example, c=a%b.
Example
OUTPUT
ii)UNARY OPERATORS:
A) Increment Operator(‘++’): ‘++’ operator used to increase the value of an integer or variable by one i.e. ++x is similar to x=x+1.
preincrement: When ++ is placed before the variable is called preincrement and its value is incremented instantly and then assigned or used. For example, ++x.
postincrement: when ++ is placed after the variable it is called postincrement and its value is first used than incremented for next statement. For example, x++.
B) Decrement Operators(‘–’): ‘–’ operator used to decrease the value of an integer or variable by one i.e. –x is similar to x=x1.
predecrement: When — is placed before the variable is called predecrement and its value is decremented instantly and then assigned or used. For example, –x.
postdecrement: when — is placed after the variable it is called postdecrement and its value is first used than incremented for next statement. For example,
preincrement: When ++ is placed before the variable is called preincrement and its value is incremented instantly and then assigned or used. For example, ++x.
postincrement: when ++ is placed after the variable it is called postincrement and its value is first used than incremented for next statement. For example, x++.
B) Decrement Operators(‘–’): ‘–’ operator used to decrease the value of an integer or variable by one i.e. –x is similar to x=x1.
predecrement: When — is placed before the variable is called predecrement and its value is decremented instantly and then assigned or used. For example, –x.
postdecrement: when — is placed after the variable it is called postdecrement and its value is first used than incremented for next statement. For example,

OUTPUT
_{}^{}
_{}^{}_{}^{}
0 Comments