View stunning SlideShares in full-screen with the new iOS app!Introducing SlideShare for AndroidExplore all your favorite topics in the SlideShare appGet the SlideShare app to Save for Later — even offline
View stunning SlideShares in full-screen with the new Android app!View stunning SlideShares in full-screen with the new iOS app!
All the basic arithmetic operations can be carried out in C. All the operators have almost the same meaning as in other languages. Both unary and binary operations are available in C language . Unary operations operate on a single operand, therefore the number 5 when operated by unary – will have the value –5.
Often it is required to compare the relationship between operands and bring out a decision and program accordingly. This is when the relational operator come into picture. C supports the following relational operators.
Operator Meaning < less than <= less than or equal to > greater than >= greater than or equal to == equal to != not equal to
The logical not operator takes single expression and evaluates to true if the expression is false and evaluates to false if the expression is true. In other words it just reverses the value of the expression. For example
if ( Condition ) return Expression1; else return Expression2;
The Condition expression must evaluate to true or false. If condition is true Expression1 is evaluated and its value is returned. If Condition is false Expression2 is evaluated and its value is returned.
Bitwise operators work on the bits stored in integral types. They work similar to the logical operators except that instead of working on true and false values they work with ones and zeroes. There are several bitwise operators available:
Symbol and their Meaning: ~ Complement & And | Or ^ Exclusive-Or << Left shift >> Right shift