C Operators
1. Arithmetic operators
The Arithmetic Operators in C: To perform Mathematical operations/calculations like calculations like addition (+), subtraction (-), multiplication (*), division (/) and modulus (%).
2 .Relational Operators
Used to compare 2 numbers or quantities
==, !=, >, < , >=, <=
ref testrelational.c
3. Logical Operators : Used to test more than one condition to make decisions. These are && (AND) , ||(OR) , ! (Not)
ref testlogical.c
4. Bitwise operators : They are used for manipulating data at bit level
Bit wise operators in C:These operators are used to perform bit operations
& Binary AND Operator
^ Binary XOR Operator
| Binary OR Operator
<< Binary Left Shift Operator
>> Binary Right Shift Operator
~ Binary Ones Complement Operator
ref: testbitoperator.c
5. Assignment operators :
These are used to assign values to variables.
= Assign the vale
+= Increment the variable by the value and assign
-= Decrement the variable by the value and assign
*= Multiplie then assign
/= Divides then assign
%= Modulus then assign
<<= Left shift and assign
>>= Right shift and assign
&= Bitwise AND assign
^= Bitwise exclusive OR and assign
|= Bitwise inclusive OR and assign
6. Conditional operator
The Conditional Operator in C, is used in the decision-making process in place of conditional statements if and else statement, to replace a short if else statement in c
Syntax of ternary operator
condition ? value_if_true : value_if_false
ref: testtern.c
7. Special operator
& operator is used to get the address of the variable
* operator stores or points to the address of another variable
sizeof() is a compile-time operator that determines the size of variable in bytes
ref testspecop.c
1. Arithmetic operators
The Arithmetic Operators in C: To perform Mathematical operations/calculations like calculations like addition (+), subtraction (-), multiplication (*), division (/) and modulus (%).
- + (Addition) – To add two operands.
- – (Subtraction) – To Subtract two operands.
- * (Multiplication) – To Multiply two operands.
- / (Division) – Divide two operands and gives the quotient as the answer.
- % (Modulus operation) – Gives the remainder after the division.
- ++ (Increment) –To increment an operand.
- — (Decrement) – To decrement an operand
2 .Relational Operators
Used to compare 2 numbers or quantities
==, !=, >, < , >=, <=
ref testrelational.c
3. Logical Operators : Used to test more than one condition to make decisions. These are && (AND) , ||(OR) , ! (Not)
ref testlogical.c
4. Bitwise operators : They are used for manipulating data at bit level
Bit wise operators in C:These operators are used to perform bit operations
& Binary AND Operator
^ Binary XOR Operator
| Binary OR Operator
<< Binary Left Shift Operator
>> Binary Right Shift Operator
~ Binary Ones Complement Operator
ref: testbitoperator.c
5. Assignment operators :
These are used to assign values to variables.
= Assign the vale
+= Increment the variable by the value and assign
-= Decrement the variable by the value and assign
*= Multiplie then assign
/= Divides then assign
%= Modulus then assign
<<= Left shift and assign
>>= Right shift and assign
&= Bitwise AND assign
^= Bitwise exclusive OR and assign
|= Bitwise inclusive OR and assign
6. Conditional operator
The Conditional Operator in C, is used in the decision-making process in place of conditional statements if and else statement, to replace a short if else statement in c
Syntax of ternary operator
condition ? value_if_true : value_if_false
ref: testtern.c
7. Special operator
& operator is used to get the address of the variable
* operator stores or points to the address of another variable
sizeof() is a compile-time operator that determines the size of variable in bytes
ref testspecop.c
No comments:
Post a Comment