將等號(=)右邊的值強制轉型,明確告訴編譯器等號(=)右邊的值的資料型態。
1 int a = (int)8.3;
1
int a = (int)8.3;
另一種強制轉型的方式,將值放在括號中()。
1 int a = int(8.3);
int a = int(8.3);