In C++ what type of operator is a cast operator?

Nguyên Lê

New member
In C++ what type of operator is a cast operator?
A. Unary
B. Binary
C. Ternary
D. Quaternary
 
Answer: A
Explanation: The cast operator is a unary operator which is used to convert one data type into another forcefully. One example is:
Code:
void setup() {
    float f=34.5;
    int i = static_cast<int>(f);
}
The code above results in the variable ‘i’ having a value of 34 stored in it.
 

Tìm kiếm

Back
Top