Variable in C++
0 3198
A variable can be known as a temporary container for storing information. The programmers are required different methods to store the data; variable provides different methods to work with numbers and value.
Example:
int q=18; Where, q = variable name
Datatypes of Variable:
Variable have datatypes. On the base of that data types, memory allocations take place by operating system.
Following are the list of datatype present in C++ programming language:
- Character types
- Integer types (signed)
- Integer types (unsigned)
- Floating-point types
- Void type
- Boolean type
- Null pointer
Example of C++ Variable Program:
#include <iostream>
using namespace std;
int main()
{
int x= 8;
int y=9;
int result =x*y;
cout<<result;
return 0;
}
Result: 72
Share:
Comments
Waiting for your comments