I l @ ve RuBoard |
Choose the type you need.
Choose a name for the variable.
Use this format for a declaration statement: type- specifier variable-name; . The type-specifier is formed from one or more of the type keywords. Here are some examples:
int erest; unsigned short cash;
To declare more than one variable of the same type, separate the variable names with commas:
char ch, init, ans;
You can initialize a variable in a declaration statement:
float mass = 6.0E24;
Summary: Storage ClassesKeywords: auto, extern, static, register General Comments: The storage class of a variable determines its scope, its linkage, and its storage duration. Storage class is determined both by where the variable is defined and by its associated keyword. Variables defined outside all functions are external, have file scope, external linkage, and static storage duration. Variables declared inside a function are automatic unless one of the other keywords is used. They have block scope, no linkage, and automatic storage duration. Variables defined with the keyword static inside a function have block scope, no linkage, and static storage duration. Variables defined with the keyword static outside a function have file scope, internal linkage, and static storage duration. Properties: In the following list, those variables in storage classes above the dotted line are declared inside a function; those below the line are defined outside a function.
|
[*] The keyword extern is used only to redeclare variables that have been defined externally elsewhere. The act of defining the variable outside a function makes it external.
I l @ ve RuBoard |