1.

What is an expression? Explain the types of expression.

Answer»

An expression is a combination of variables, constants and operators written according to the syntax of C++ language. In C++ every expression evaluates to a value i.e., every expression results in some value of a certain type that can be assigned to a

ExpressionTypes of operators usedDescription
Arithmetic
expressions
Arithmetic operatorsThese are used to perform mathematical calculations like addition,subtraction ,multiplication,division and modulus
Assignment operatorsThese are used to assign the values for the variables in C programs.
Relational expressionsRelational operatorsThese operators are used to compare the value of two variables.
Logical expressionLogical operatorsThese operators are used to perform logical operations on the given two variables.
Bit wise expressionsBit wise operatorsThese operators are used to perform bit operations on given two variables.
Ternary expressionsConditional(ternary)operatorsConditional operators return one value if condition is true and returns another value is condition is false.
Unary expressionsIncrement/decrement operatorsThese operators are used to either increase or decrease the value of the variable by one. 
Special operators&,*,sizeof() and ternary operators.


Discussion

No Comment Found

Related InterviewSolutions