[C++] Type conversion

In C++, there is an implicit type conversion syntax (automatic type conversion)

int a=11;
a=1.23+a;

In C++, there is an explicit type conversion syntax

格式: 类型名(变量名);:
int a=int(99.2);

In C, there is an explicit type conversion syntax

格式:(类型名)变量名;:
int num=(int)12.3;

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_46527915/article/details/114374716