Reputation: 297
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
Upvotes: 2
Views: 192
Reputation: 272457
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
Upvotes: 6