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

A.5.1 Declaring Variables

A variable declaration begins with the data type (e.g., int), followed by the name of one or more variables of the same type that are separated by commas. A variable declaration can also contain an initial value, and always ends with a semicolon ( ;). Variable names must begin with a letter in C. A name can include letters, numbers, and the underscore ( _) character. Note that the C preprocessor is case-sensitive (recognizes uppercase and lowercase letters as being different). Below are some examples of variable declarations.

int n;                   /* declaring variable n as an integer        */
int i1, i2;              /* declaring variables i1 and i2 as integers */
float tmax = 0.;         /* tmax is a floating point real number        
                            that is initialized to 0                  */
real average_temp = 0.0; /* average_temp is a real number initialized   
                            to 0.0                                    */


next up previous contents index Previous: A.5 Variables
Up: A.5 Variables
Next: A.5.2 External Variables
Release 12.0 © ANSYS, Inc. 2009-01-14