Next Previous Contents

83. typecast

Synopsis

Convert an object from one data type to another.

Usage

typecast (x, new_type)

Description

The typecast function performs a generic typecast operation on x to convert it to new_type. If x represents an array, the function will attempt to convert all elements of x to new_type. Not all objects can be converted and a type-mismatch error will result upon failure.

Example

    define to_complex (x)
    {
       return typecast (x, Complex_Type);
    }
defines a function that converts its argument, x to a complex number.
See Also

int, double, typeof


Next Previous Contents