[ANSYS, Inc. Logo] return to home search
next up previous contents index

A.7 Casting

You can convert from one data type to another by casting. A cast is denoted by type, where the type is int, float, etc., as shown in the following example:

int x = 1;
real y = 3.14159;
int z = x+((int) y);       /* z = 4 */


next up previous contents index Previous: A.6 User-Defined Data Types
Up: A. C Programming Basics
Next: A.8 Functions
Release 12.0 © ANSYS, Inc. 2009-01-14