Variables: Declaring Variables
Applies To: C++Builder 1 or higher
Category: C++ Language
- In order to use a variable, you must give the compiler the type name
- and variable name. This procedure is called variable declaration. A variable declaration uses the following general form:
-
-
- The variable type_name specifies a valid data type. variable_name contains the name of the variable. Here's an example:
-
- // An integer variable
- int x;
-
- You can declare more than one variable of the same type using commas:
-
- // Two integer variables
- int x, y;
-
- Notes
- - There is a difference between declaration and definition. A declaration specifies the name and type of the variable, while a definition physically creates it and allocates memory for it.
C++Builder Developer's Network
Copyright © Yoto Yotov