Types of Operator in C Programming Notes
In C programming there are several operators are there those are, arithmetic operator, assignment, increment , decrement, logical, conditional, comma, size of , bitwise and others. So get all types of operator in C Programming notes in simple and understandable words.
An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations.
In this article, I will be sharing different types of Operator in C Programming Notes.
Types of Operators in C Language
An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations.
C operators can be classified as
1. Arithmetic operators
2. Relational operators
3. Logical operators
4. Assignment operators
5. Increment or Decrement operators
6. Conditional operator
7. Bit wise operators
8. Special operators
Increment and Decrement operators in C
The Unary operator ++, --, is used as increment and decrement which acts upon single operand. Increment operator increases the value of variable by one. Similarly decrement operator decrease the value of the variable by one. And these operator can only used with the variable, but cann't use with expression and constant as ++6 or ++(x+y+z).
It again categories into prefix post fix . In the prefix the value of the variable is
incremented 1st, then the new value is used, where as in postfix the operator is
written after the operand(such as m++,m--).
EXAMPLE
let y=12;
z= ++y;
y= y+1;
z= y;
Similarly in the postfix increment and decrement operator is used in the operation .And then increment and decrement is perform.
CONDITIONAL OPERATOR in C
exp1 ? exp2 : exp3;
It work as if exp1 is true then exp2 else exp3
It sometimes called as ternary operator. Since it required three expressions as operand and it is represented as (? , :).
SYNTAX
exp1 ? exp2 :exp3
Here exp1 is first evaluated. It is true then value return will be exp2 . If false then exp3.
BIT WISE OPERATORS in C Programming
- one's complement (~)
- bitwise AND (&)
- bitwise OR (|)
- bitwise XOR (^)
- left shift (<<)
- right shift (>>)
SPECIAL OPERATORS in C
sizeof operator is used to know the sizeof operand.
To know rest of operator detail visit: Operator in C programming
Want to Know more So Checkout more such Knowledgeable Article and Comment below for any Queries and more.
Check more posts on Programming and Information related to Coding only at Copy2Run Programs
Thanks for Visiting – Stay Updated with our Site and keep Visiting.
Comments
Post a Comment