C++ Programming Free Online Course 3 (Understanding Variables)
Variables in C++ is a name given to a memory location. It is the basic unit of storage in a program. The value stored in a variable can be changed during program execution. A variable is only a name given to a memory location, all the operations done on the variable effects that memory location. In C++, all the variables must be declared before use. How to Declare Variables? A typical variable declaration is of the form: // Declaring a single variable type variable_name; // Declaring multiple variables: type variable1_name, variable2_name, variable3_name; A variable name can consist of alphabets (both upper and lower case), numbers, and the underscore ‘_’ character. However, the name must not start with a number. Initialization of a variable in C++ datatype : Type of data that can be stored in this variable. variable_name : Name given to the variable. value : It is the initial value stored in the variable. Examples : ...