C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Home » C programming language

Difference between operators and operands in C/C++ programming language

Learn: What are the differences between operators and operands in C, C++ and other programming languages, this tutorial will explain about the expression, operands and operators in details.

Consider the following expression

x = a+b;

In this expression x, a and y are the operands, = and + are the operands.

An expression may have following parts

  1. Operands
  2. Operators
  3. Special symbols (also known as operators)

1) Operands

In any operation, an operand may any numerical value (known as literals in programming languages), variables, constant, function calling etc on which program makes an operation.

For example, if we want to add two integer numbers through the expression (10+20), here 10 and 20 are being added through operator +, thus 10 and 20 are the operands. Same as if we want to add two variables through the expression (a+b), here a and b are being added through the operator +, this x and y are also the operands.

2) Operators

Operators are the special kinds of symbols (or function like words (sizeof)) that are used to perform any specific task like mathematical and logical.

For example, there is an expression to add two integer numbers (10+20), here 10 and 20 are the operands and being added through the special symbol + (plus), thus plus (+) is an operator here. Another example, there is a logical expression (age>=18), here we are going to check whether age is greater than or equal to 18 or not, thus greater than or equal to (>=) is the combination of two special symbols > and =, it is also an operator in C/C++ and other programming languages too.

3) Special Symbols

In any programming language, an expression may have other special symbols too, that are not used to perform any mathematical or logical operations but they are also an important part of an expression.

For example, there is an expression x= (a+b); here, ; (semicolon) and brackets are operators, semicolon (;) is using to terminate the expression and brackets are using to put the expression in an unit.







COMMENTS