Can anyone please explain what the difference between explicit conversion of integer to char
int i = 100;
char c2 = (char)i;
to assignment integer type to char
char i = 100;
thank you very much
There is no behavioural difference.
However, some compilers may be configured to warn about implicit "narrowing" conversions. So code like this may provoke a warning:
int i = ...;
char c = i; // Implicit conversion
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.