What are Misc Operators?
Besides arithmetic, logical, relational C++ language provides some more valuable operators, known as miscellaneous operators. Misc operators are unique kinds of operators. Various operators contain three operands: the first gets evaluated first if non zero, then the second gets considered, and the last one shows the result. Misc operators help reduce work by giving quick results. This operator directly works on the data and its address.
Operators
- (?:) Operator - This operator is known as a conditional or ternary operator. In this operator condition, two operands get checked. Three operands get used. The first two are the operands whose condition gets scanned, and the result shows in the third one.
- sizeOf() : sizeOf() returns the size of the variable that we pass in it.
E.g., sizeOf(a) now if this a is an integer, it will return 4. It returns as per the data type of the variable.
- (&) : The address of the given variable is being returned by the given variable.
E.g., &a this will return the exact address of a.
- (*) : This points to the memory location of the respective variable.
- Cast: This operator is used to cast one data type into another.
- “,”: Comma operator is used to define the sequence of operators.