CONCEPT C.pdf - C Operators An operator is a symbol that...

This preview shows page 1 - 4 out of 9 pages.

C - Operators An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. C language is rich in built-in operators. Types of Operators- 1.Unary operators are those that work on single operand e.g. increment operator( ++) or the decrement operator( - - ). int a =b++; or something like int C =d- -; 2.Binary operators are the one that operate on two operands e.g. ‘+’, ‘ - ’, ‘ *’, ‘/’. Syntax can be like int C=a+b; 3. Ternary operators are the one that operates on three operands. It takes three argumets . 1st argument is checked for its validity . If it is true 2nd argument is returned else third argument is returned. For example if we write int C= a>b ? e:f; now if a is greater than b 'e' is returned otherwise 'f' is returned. C operators can be classified into following types: Arithmetic Operators Relational Operators Logical Operators Bitwise Operators Assignment Operators Misc Operators 1).Arithmetic Operators The following table shows all the arithmetic operators supported by the C language. Assume variable A =10 and variable B = 20 then −
Image of page 1

Subscribe to view the full document.