variable casting c++ code example
Example 1: casting C++
int main()
{
short a = 2000;
int b;
b = (int)a; // c-like cast notation
b = int(a); // functional notation
}
Example 2: c++ casting
static_cast<int>(some_double);
int main()
{
short a = 2000;
int b;
b = (int)a; // c-like cast notation
b = int(a); // functional notation
}
static_cast<int>(some_double);