Showing posts with label Assignment. Show all posts
Showing posts with label Assignment. Show all posts

Monday, January 25, 2016

C Operators - Arithmetic, Assignment, Relational and Logical

Operator Basics

Operators in C language are symbols which tells the compiler to perform some mathematical calculations or logical operations (we will look at in a while) on the variables and constants. For example, consider the mathematical operation "10 + 2 - a". Here '+' and '-' are called operators and the values on which operators work ('10', '2', and 'a') are known as operands. C programming language has wide variety of operators which are categorised into different groups based on the type of operations they perform.

Operator Arity

Arity implies the number of operands the operator is defined to work on. Based on that we have operators of following articles
ArityDescription
Unary OperatorOperates on single operand.
Binary OperatorOperates on two operands, For example: '/' (used for division).
Ternary OperatorOperates on three operands. Example : conditional operator (we will discuss about it in this chapter).
n-ary OperatorOperators that operate on more than 3 operands.