Operator used in C program
Operators used in C Program:
The symbols known as operators are those that are utilised in arithmetic operations or for logical comparison. The operator works with real numbers, characters, and integers. Operator use in program to manipulate data and variable.
In C, operator are classified into number of categories these are:
1)Arithmetic operators.
2)Relation operators.
3)Logical operators.
4)Assignment operators.
5)Conditional operators.
6)Bitwise operators.
1)Arithmetic operator:
For performing the basic mathematical calculation.
Arithmetic operator in C:
2)Relation operator:
When two values are compared, this operator produces one of two results: either true or false. Relational operator are as
follow:
3)Logical operator:
After combining and comparing two or more expressions that may include arithmetic or relational operators, this operator produces true and false results. The logical operator are as follow:
4)Assignment operator:
Simple equal to sign(=) is the assignment operator. To assign the value, use this operator.
Ex: pi=3.14
c=a + b
5)Conditional operator :
Condition operator is also called as ternary
operator. This uses two operator (i.e ? and :).This operator compare two
value and gives single value after comparing expression. General syntax of
conditional operator are as follow:
(expression?expression
1:expression 2);
Ex:
(a>b?a:b);
If value a
is greater than b then a is printed otherwise b is printed.
Conditional
operator is nothing but short form of if-else, where if and else is replaced by
? and :.
6)Bitwise operator:
Each item of data is handled by this operator. When testing, complementing, or shifting bits to the right or left, these operators are utilized.
Comments
Post a Comment