Hyper Dictionary

English Dictionary Computer Dictionary Video Dictionary Thesaurus Dream Dictionary Medical Dictionary


Search Dictionary:  

Meaning of EXPLICIT TYPE CONVERSION

 Sponsored Links: 
 
Computing Dictionary
 
 Definition: 

(Or "cast" in c and elsewhere). A programming construct (syntax) to specify that an expression's value should be converted to a different type.

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 value to char type. Casts (including this one) are often not strictly necessary, due to automatic coercions performed by the compiler, but can be used to make the conversion obvious and to avoid warning messages.

 

 

COPYRIGHT © 2000-2008 HYPERDICTIONARY.COM HOME | ABOUT HYPERDICTIONARY