C++ tutorial, C++ programs, C++ Exercises, C++ Example Programs

Tuesday, April 10, 2012

Explain Variables in Programming C++

Variables




Variable may be defined as a named memory location to store program data temporarily during the execution of the program. So, a variable can be used to store name of a student or pay of an employee etc. in a C++ program or in any other programming language.
We can store data in a variable and can change the data or value contained in the variable time to time during program execution. We can access a variable with its name. Therefore, whenever we need value of the variable we will use the variable name for reference.


If we want to change the value of a variable, we will assign the new value to it. Now the variable will lost the old value and the new value will be placed in the memory location of that variable.

how many values a variable can have?

An atomic variable can have only one value at a time. No doubt, its value or contents can be changes time to time during program execution, but it will have only one value at a time.

Variables and Data Types

Variables can be of different data types according to the data they are going to store. For example, integer data type is used to declare such variables that can hold numeric data in whole numbers. Float data type will be used to declare variable to hold numbers with fractional parts.

Where Are Variables Created?

Variables are created in computer memory called RAM - Random Access Memory. There are different types of variables. Each data type variable can take some bytes of memory to store a particular value. For example, a variable of integer data type will take two bytes of memory in RAM.

Variables in C++
1 Explain
Variables in Programming C++
2 Naming
Rules For C++ Variables
Share:

0 comments:

Post a Comment

We Love To Hear From You!

EasyCPPprogramming.blogspotcom

Labels