In case of the following static_cast conversion, what will be the output of the program?
#include <iostream>

int main() {
    std::cout<< ++static_cast<int>(*(new int(5)));
}
Explanation
5.2.9 Static cast
The result of the expression static_cast<T>(v) is the result of converting the expression v to type T. If T is a reference type, the result is an lvalue; otherwise, the result is an rvalue.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C++ quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes