DATA TYPE IN C++
MINI WORLD
DATA TYPE :
Data types define the type of data a variable can hold, for example an integer variable can hold integer data, a character type variable can hold character data etc. Data types in C++ are categorised in three groups: Built-in, user-defined and Derived.
When we write a program in any language, we need to use various variables like boolean, integer, floating, double, character and the like to store various information. Variables are nothing but reserved memory locations to store values. This means that when we create a variable we reserve some space in memory. Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory.
DATA TYPES KEYWORDS WHICH USED IN C++
Data Type Wise Memory Size And Range Of Values
Data Type Memory Size Code In C++ And Output
#include <iostream>
using namespace std;
int main ()
{
cout << "THE SIZE OF bool : " << sizeof(bool) << endl;
cout << "THE SIZE OF char : " << sizeof(char) << endl;
cout << "THE SIZE OF unsigned char : " << sizeof(unsigned char) << endl;
cout << "THE SIZE OF signed char : " << sizeof(signed char) << endl;
cout << "THE SIZE OF void : " << sizeof(void) << endl;
cout << "THE SIZE OF short : " << sizeof(short) << endl;
cout << "THE SIZE OF unsigned short : " << sizeof(unsigned short) << endl;
cout << "THE SIZE OF short int : " << sizeof(short int) << endl;
cout << "THE SIZE OF unsigned short int : " << sizeof(unsigned short int) << endl;
cout << "THE SIZE OF signed short int : " << sizeof(signed short int) << endl;
cout << "THE SIZE OF wchar_t : " << sizeof(wchar_t) << endl;
cout << "THE SIZE OF unsigned : " << sizeof(unsigned) << endl;
cout << "THE SIZE OF signed : " << sizeof(signed) << endl;
cout << "THE SIZE OF int : " << sizeof(int) << endl;
cout << "THE SIZE OF unsigned int : " << sizeof(unsigned int) << endl;
cout << "THE SIZE OF signed int : " << sizeof(signed int) << endl;
cout << "THE SIZE OF long : " << sizeof(long) << endl;
cout << "THE SIZE OF long int : " << sizeof(long int) << endl;
cout << "THE SIZE OF unsigned long int : " << sizeof(unsigned long int) << endl;
cout << "THE SIZE OF signed long int : " << sizeof(signed long int) << endl;
cout << "THE SIZE OF float : " << sizeof(float) << endl;
cout << "THE SIZE OF long long : " << sizeof(long long) << endl;
cout << "THE SIZE OF unsigned long long : " << sizeof(unsigned long long) << endl;
cout << "THE SIZE OF signed long long : " << sizeof(signed long long) << endl;
cout << "THE SIZE OF long long int : " << sizeof(long long int) << endl;
cout << "THE SIZE OF unsigned long long int : " << sizeof(unsigned long long int) << endl;
cout << "THE SIZE OF signed long long int : " << sizeof(signed long long int) << endl;
cout << "THE SIZE OF double : " << sizeof(double) << endl;
cout << "THE SIZE OF long double : " << sizeof(long double) << endl;
return 0;
}
OUTPUT :::
No comments