Rules to Declare Variable in C++

Advertisements

Variable in C++ Scope of Variable in C++

Variable Declaration Rule in C++

To Declare any variable in C++ you need to follow rules and regulation of C++ Language, which is given below;

  • Every variable name should start with alphabets or underscore (_).
  • No spaces are allowed in variable declaration.
  • Except underscore (_) no special symbol are allowed in the middle of the variable declaration.
  • Maximum length of variable is 8 characters depend on compiler and operation system.
  • Every variable name always should exist in the left hand side of assignment operator.
  • No keyword should access variable name.

Note: In a c program variable name always can be used to identify the input or output data.

Variable declarations

This is the process of allocating sufficient memory space for the data in term of variable.

Syntax

Datatype  variable_name;
int  a;
variable declaration rule in c++

If no input values are assigned by the user than system will gives a default value called garbage value.


Variable in C++ Scope of Variable in C++

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements