Operators in C Programming
Arithmetic operators
Multiply(*)
Divide(/)
Addition(+)
Subtraction(-)
Modulus(%)
Less than(<)
Greater than(>)
Less than equal to(<=)
Greater than equal to(>=)
Equality operator
Equal to(==)
Not equal to(!=)
Logical operator
Logical AND (&&)
Logical OR (||)
Unary operator
Increment operator
(++) ,
Decrement operator (--)
Eg/ x=i++=i+1 x=x--=x-1 let i=5 let i=5
i++=i+1=5+1=6 i--=i-1=5-1=4
Conditional operator
exp 1 ? exp 2 : exp 3
eg/ Large=(a>b) ? a : b //like a if-else condition
Assignment
operator
eg/ int x
x=10;
x=3,y=2;
sum=x + y; //x=5
Sizeof
operator
Eg / int a=10
result= sizeof (a) ; //result
=2 byte
Bitwise operator
§Perform operation at the bit level like bitwise
OR,bitwise AND,bitwise XOR etc
Eg 10101010 10101010=11111111
No comments:
Post a Comment