21 September, 2018

Ratings

It is a special kind of symbol which perform a particular task. In ‘c’ programming language total no.of operators are ‘44’ and depends on no.of operators these operators are classified into 3 types. i.e.

- unary
- Binary
- Terinary

When we are working with unary operator which required one operand only.

Binary operator always takes two operands

Terinary requires three arguments. E.g.: 2+3 When we are evaluating the expression one input data we are providing those are called operant & Argument which symbol we are using is called operator.

It is a binary data category operator

- Binary category means it requires two arguments i.e, Left and right side arguments.
- When we are working with Binary operator among those two argument if any one of the argument is missing then it gives an error.
- When we are working with assignment operator left side argument must be a variable type only & Right side is optional.

** Syntax:- **L=R

- a=40 Error statement missing (;)
- a=50; 50 (No error)
- a=’d’; d
- a=’d’; d
- 10=20; Error
- A=; Error R value requires expression
- A=25; Error L value requires expression
- A=10;

b=a;

In ‘C’ programming language there are 5 types of arithmetic operators are available. Multiplication, division, Modus, addition, subtraction All arithmetic operators are binary operators only which require “2” Arguments. In implementation whenever an expression contains more than one operator then in order to evaluate the expression, we require to follow priority of the operator. Which operator contains highest priority, it should be evaluated first, which operator contains least priority, that one at last. When the equal priority is occur, then if it is binary then evaluate towards from left to right, if it is unary then evaluate towards from right to left.

- * / % Eg:- if a=2+3=5
- +_ Return value is collected at the time of compilation.
- =

**Ex:** 1). If a=2+3*2+3; 2+6+3=8+3=11 2). If a=5+3-2; 8-2 =6 Same priority then evaluate from left to right 3). If a=5+; Error 4). If a=8-; Error. 5).If a=+5; 5 6).If a=-8,-5 When we are working with +, -, symbols then it works as a unary and binary operator also When the symbol is available, then it indicates arithmetic binary operator. If the symbol is available before the operand then it indicates the sign of the value which indicates unary operator. 5/2 2 int, int - int 5.0/2 2.5 int, float 5/2.0 2.5 float, int } float 5.0/2.0 2.5 float,float } float 2/5 0 2.0/5 0.4 -5/2 -2 5/-2 -2 -5/-2 -2 Operator behaviour is always variable independent only. i.e depends on the variable type the behaviour of the operator will not be changed Operator behaviour is always operand dependent only i.e, it depends on the input type, the behaviour of the operator changes. If both arguments are integer, then return value is integer., if any one of the argument is float or both are float then written value is float. O/P sign will depends on numerator sign and denominator sign also. Among those, two arguments any one of the argument is “-ve”, then return value is –ve , if both are ‘-ve’ then return value is ‘+ve’

Modulus operator returns reminder value In modulus operator, o/p sign will depends on numerator sign only. Modulus operator require two arguments UR type integers only i.e, we can’t apply for float data values,

- A= 12%4; =0, a=15%2; 1

A= 21%8; 5 47%5; 2, -47%-5; -2 47%5; 2 , 5%2; 1 -47%5; 2, 2%5; 2 [ 2/5----> 0 in division operator] If the numerator is less than half the denominator value, then if it is division operator returns “Zero”. If it is “mod” %operator. Returns numerator value A= 3*15.0/5%2; = 4.5.0/5%2; = 9.0%2; Error floating operation can’t be applied for modules. In implementation, when we are working with module operator then we can’t apply for float data type. So, in this case recommended to go for Library f’ns, i.e fmode() or fmodl() f’ns, we can find remainder value of float data types which is available in math.h In implementation, when we need to extract last digit from the given i/p data, then go for %10, if we required to remove the last digit from the given num, then go for /10

In c and c++, all relational and logical operators are returns “1”,”0” If the expression is true, then returns with 1, if the expression is false, then returns with “0” Every non Zero is called true, when the value become Zero, it is false. Relational operators <,>,<=,>=,==,!= Logical operators are &&,!!

- ()
- +,-;! (signs) Uninory operator.
- *,/,%
- +, -
- <,>,<=,>=
- ==,!=
- &&
- ||
- ?: Condition operator or terinary.

10.= a=2>5; false =0 return value a=5<8;1 True, return value 1 a=3<2<0;0 a=3>2>0; 0<0 1>0 a=2>3<2; a=5<8>2;0 0<2; 1 return value a=5<8>2; 0 1>2

1>1A=3>2>1>0>-1; -1 0>-1 If a=2>5<=0; 1 0<=0 A=5<8>=2; 0 0>=2; A=(2>5)<=(5<2) A=(0)<=(0) A=1 | 1>1------ > 0 0 A=i>=0<=2; 1 i<=2=1 (true) A=2>5<=5<2 0<=5<2 1<2; 1 A=2+3*2+3 2+6+3; A=11 |

A=3>2>1; 0 a=3>2>1>0; 0 A=(2+3) * (2+3) A=5*5 =25

In c and c++ all relational and logical operators returns “1 or 0” If the expression is then it returns with one, if expression is false , then it returns with Zero. Every non-zero is called true, (0) the value become Zero, it is false. Relational operators are <.>,<,<=,>=,==,!= Logical operators are &&,!,..

A=2==5; 0A=8=8; 1 A=2>5==1; 0 A=2>5==5<2; 1 A=1==2<5; 1 A=5/2 == 2+5; 0 2==7 A=8%4 == 12%6; 1 A=2<5! =5>2;0 1!=1 A=2<8==1>5!=1==5<8;1 1==0!=1==1 0=1 | L=R; -> right side value assigned to left sideL=R-> equality L!=R-> Not equal A=2!=2;0 A=5!=8; 1 1^{st} priority 1!=1 A=5>8!=0; 0 A=1!=1<5==2>1=0 1!=1==1 |

a | b | a&&b | a||b | !a |

1 | 1 | 1 | 1 | 0 |

0 | 1 | 0 | 1 | 1 |

1 | 0 | 0 | 1 | 0 |

0 | 0 | 0 | 0 | 1 |

&& | || | ! | |||||

TT | T | TF | T | T –F | |||

TF | F | TF | T | F-T | |||

FT | F | FT | T | ||||

FF | F | FF | F |

A=2<5&& 2>5; 0A=2>5 && 2<5; 0 A=5<8 && 8<5;0 1 && 0 A=2>5 && 5>8; 0 A=2<5 && 8>5;1 A=1!=2>5 && 8>5; 1 A=2<5 or 5<2; A=5>8-11 8>2; 1 A=!5; 0 A=!=0;1 A=!2>5; 1 | A=5>!=0 && 2>8!=1 ;11!=0 && 0!=1 1 && 1 A=5>2==2<8&&8>5!=0; 1 A=1!=2*5 or 0!=2>5; 1 A=5<8!=0 or 8>2!=1 1!=0 or 1 !=1 1 or 0 =1 |

Cprogramming language is a case sensitive language i.e. upper case content and lower case content both are different In a c programming language, existing keywords and predefined f’ns all are available in lower case only. Program to print “welcome” Void main() { Printf(“welcome”) } **o/p: **welcome

TekSlate

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .