In this program, we will create 3 variables and initialize them with some values. Then we will use the "<=>" operator to compare the value of variables.
The "<=>" operator returns an integer value.
- Returns 0 when both variables are equal.
- Returns 1 when the first operand is greater than the second operand.
- Returns -1 when the first operand is less than the second operand.
Program/Source Code:
The source code to demonstrate the "<=>" operator is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we created three variables and initialized 10, 10, 30 respectively. Then we used the "<=>" operator to compare values of variables and printed the returned value.
need an explanation for this answer? contact us directly to get an explanation for this answer