C++ Size of different variables

Objectives :

  • size of different variables
    //varsize.cpp
    #include <iostream>
    int main()
    {
    cout <<"size of int:\t "<< sizeof(int) <<"bytes.\n";
    cout <<"size of short \t"<< sizeof(short) <<"bytes.\n";
    //cout <<"size of ushort \t"<< sizeof(Ushort) <<"bytes.\n";
    cout <<"size of char \t"<< sizeof(char) <<"bytes.\n";
    cout <<"size of long \t"<< sizeof(long) <<"bytes.\n";
    cout <<"size of float \t"<< sizeof(float) <<"bytes.\n";
    cout <<"size of double \t"<< sizeof(double) <<"bytes.\n";
    cout <<"size of wchar_t " << sizeof( wchar_t) <<"bytes.\n";
    cout <<"size of Bool " << sizeof( bool) <<"bytes.\n";
    return 0;
    }