data types used in c++ language
Fundamental data types
int , char, float, double , bool, void etc
Derived data types
array , pointer etc.
User defined data types
structure, union, enum and class etc.
c++ modifier
signed, unsigned short, long
char 1 byte
int 2/4 byte (depends on your system configuration)
signed int 2 byte
unsigned int 2 byte
short int 2 byte
long int 4 byte
float 4 byte
double 8 byte
long double 10 byte
programme to display the size of data types in c++
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
cout << "Size of char : " << sizeof(char) << endl;
cout << "Size of int : " << sizeof(int) << endl;
cout << "Size of short int : " << sizeof(short int) << endl;
cout << "Size of long int : " << sizeof(long int) << endl;
cout << "Size of float : " << sizeof(float) << endl;
cout << "Size of double : " << sizeof(double) << endl;
cout << "Size of wchar_t : " << sizeof(wchar_t) << endl;
double b=1.2345678912345678912345;
cout<<b;
cout<<endl;
cout<< setprecision(12)<<b;
cout<<endl;
wchar_t w = L'A';
cout << "Wide character value:: " << w << endl ;
cout << "Size of the wide char is:: " << sizeof(w);
return 0;
}