Tuesday, June 12, 2012

Expressions, Operators and Punctuators

    Variable names, function names, array names, constants, function calls, array references, structure references are all considered expressions. Applying a unary operator to one of these appropriate expressions or combining two or more expressions also leads to an expression. An expression enclosed within parentheses is also an expression.


An expression that may be assigned a value is known as an Lvalue. An lvalue expression is required in certain places: The expression on the left hand side of an assignment operator must be an lvalue. The increment and decrement operators can only be applied to lvalue, as can the unary address operator ‘&’. An lvalue is also required to the left of the structure member operator ‘.’.


Operators with their Precedence

The operators in C can be Arithmetic, Relational, Logical, Increment, Decrement and Bitwise Logical. Most of theoperators are binary; that means they need two operands. Unary Operators need only one operand.
Turbo C/C++ operators are divided into 16 categories. The #1 category has the highest precedence.
Category #2 takes the second and so on to the comma (,) operator that has the lowest.









No comments:

Post a Comment