Variable in C++

by Monika Dadool 04-Sep-18

0 435


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.
For e.g.

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:

1) Character types
2) Integer types (signed)
3) Integer types (unsigned)
4) Floating-point types
5) Void type
6) Boolean type
7) Null pointer

A simple 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

    No Comments Yet.

Leave a Reply