What does this code mean? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What does this code mean?

How does the following code do? What does it mean? : static_cast<int>

10th Jun 2019, 11:01 AM
‎Mustafa Haider
‎Mustafa Haider - avatar
4 Answers
+ 7
static_cast in C++ Type Casting operators. ... Static Cast: This is the simplest type of cast which can be used. It is a compile time cast.It does things like implicit conversions between types (such as int to float, or pointer to void*), and it can also call explicit conversion functions (or implicit ones).
12th Jun 2019, 8:52 AM
GeneralZod
GeneralZod - avatar
+ 3
This is a static integer conversion, it is the same as int a = 3; or something.
11th Jun 2019, 2:40 PM
Almir
Almir - avatar
+ 1
Almir I know that is data type, but I dont know how to use?
11th Jun 2019, 5:33 PM
‎Mustafa Haider
‎Mustafa Haider - avatar
0
#include <iostream> int main() { int a = 4; int b = static_cast<int>(4); // same thing above a == b }
12th Jun 2019, 12:27 AM
Almir
Almir - avatar