Programming: Converting a Type to Another Type by Type Casting

If there is a variable that is of a specific type and another type is desired, that variable can be cast the desired type.



For example: If you have an integer and want this converted to a double precision number: double NewDoubleVariable = (double) IntegerVariable; If you do the reverse, convert a double to an integer, you will loose all of the fractional (decimal precision) value.
Back to blog

Leave a comment

Please note, comments need to be approved before they are published.