0 like 0 dislike
101 views
in Computer Science by (1.0m points)
What are operators? Explain different types of operators.

1 Answer

0 like 0 dislike
by (1.0m points)
Operators are special type of functions, that takes one or more arguments and produces a new value. For example : addition (+), substraction (-), multiplication (*) etc, are all operators. Operators are used to perform various operations on variables and constants.

Types of operators

Assignment Operator

Mathematical Operators

Relational Operators

Logical Operators

Bitwise Operators

Shift Operators

Unary Operators

Ternary Operator

Comma Operator

Assignment Operator (=)

Operates '=' is used for assignment, it takes the right-hand side (called rvalue) and copy it into the left-hand side (called lvalue). Assignment operator is the only operator which can be overloaded but cannot be inherited.

Mathematical Operators

There are operators used to perform basic mathematical operations. Addition (+) , subtraction (-) , diversion (/) multiplication (*) and modulus (%) are the basic mathematical operators. Modulus operator cannot be used with floating-point numbers.

C++ and C also use a shorthand notation to perform an operation and assignm

Relational Operators

These operators establish a relationship between operands. The relational operators are : less than (<) , grater thatn (>) , less than or equal to (<=), greater than equal to (>=), equivalent (==) and not equivalent (!=).

You must notice that assignment operator is (=) and there is a relational operator, for equivalent (==). These two are different from each other, the assignment operator assigns the value to any variable, whereas equivalent operator is used to compare values, like in if-else conditions, Example

Related questions

0 like 0 dislike
1 answer 21 views
0 like 0 dislike
1 answer 29 views
0 like 0 dislike
1 answer 61 views
0 like 0 dislike
1 answer 26 views
0 like 0 dislike
1 answer 26 views
0 like 0 dislike
1 answer 31 views
0 like 0 dislike
1 answer 29 views
0 like 0 dislike
1 answer 188 views
0 like 0 dislike
1 answer 41 views
0 like 0 dislike
1 answer 44 views
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute: School, College, University, Academy Free Homework Help

19.4k questions

18.3k answers

8.7k comments

3.3k users

Free Hit Counters
...