Operator used in C program
Operators used in C Program:
The Operator are the symbols that are used to perform an arithmetic operation or used for logical comparison. The operator operate on integer, character and real number. 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:
This operator are use to compare two values and result in one of two outcomes either true or false. Relational operator are as follow:
3)Logical operator:
This operator produce true and false result after combining and comparing two or more expression that may use arithmetic or relational operators. The logical operator are as follow:
4)Assignment operator:
The assignment operator is simple equal to sign(=).These operator is used to assign the value.
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:
This operator operate on each bit of data. These operator are used for testing, complementing or shifting bits to right or left.
Comments
Post a Comment