explicit type conversion
explicit type conversion
(programming)For example, in C, to convert an integer (usually 32 bits)to a char (usually 8 bits) we might write:
int i = 42;char *p = &buf;*p = (char) i;
The expression "(char)" (called a "cast") converts i's valueto char type. Casts (including this one) are often notstrictly necessary, due to automatic coercions performed bythe compiler, but can be used to make the conversion obviousand to avoid warning messages.