C++

Variables

A variable definition associates a memory location to the variable name. A variable is an entity which may vary during the program’s execution. A variable can hold only one value at a time during program execution. It’s value can be changed during program execution.

C++ allows declaration of variables before and after executable statements. It allows declaration of the variables any where in the scope i.e. a variable can be declared right at where the place of it use.

A variable is an object that may take on values of the specified type. The variable must be declared by specifying the data type and identifier.
Rules for constructing variable names:

  • A variable name can be any combination of alphabets, digits or underscore.
  • The first character in variable name must be an alphabet.
  • No commas or blanks are allowed within a variable name.
  • No special symbols other than underscore can be used in variable name.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s