operators in c program
C-Operators
An operator is used to do some operation taht can be performed on data.There are eight types of operators in C to do the operations. thery are
Types of Operators
An operator is used to do some operation taht can be performed on data.There are eight types of operators in C to do the operations. thery are
Types of Operators
- Arithmetic operators
- Relation operators
- Logical operators
- Conditional operators
- Increment / Decrement operators
- Bitwise operators
- Special operators
- Short hand assignment operators
Arithmetiic operator s are used to do the arithmetic Calculation
The general form is
variable1 AO Variable2
variable -constant(or) variables
AO-Arithmetic operator
OPERATOR OPERATION EXAMPLE
- + Addition x=2+2
- - Subraction y=10-4
- * Multiplication z=2*2
- / Division a=8/2
- % Modulo b=3%2
Relation operators
Relation operation is used to find out the relationship between two given variable.
The general form is
Operand1 RO Operand2
operand-variables
RO-relational operator
- > greater than A > B
- < less than A < B
- >= greater than equal to A>=B
- <= less than equal to A<=B
- == equal to A==B
- != not equal to A!=B
Logical Operator
Logical operation is used to find out the relationship between relational Expression.
The general form is
Operand1 LO Operand2
where the,
operand - variable
LO - Logical Operator
- && AND X&&Y
- || OR X||Y
- ! NOT X!X=X
Increment / Decrement Operator
Increment Operator
++ is the increment operator. yhis adds 1 to the value contained in the variable.The general form is
Variable ++ ++ variable
Example
1. a++ which is equal to a=a+1
2. ++a which is equal to a=a+1
Decrement Operator
-- is the Decrement operator. this subtracts 1 to the value contained in the variable.The general form is
Variable-- -- variable
Example
1. a-- which is equal to a=a-1
2. --a which is equal to a=a-1
youtube tutorial
Comments
Post a Comment