#include <iostream>
using namespace std;
int main()
{
cout << "sizeOf(bool) = " << sizeof(bool) <<endl;
cout << "sizeOf(short) = " << sizeof(short) <<endl;
cout << "sizeOf(int) = " << sizeof(int) <<endl;
cout << "sizeOf(long) = " << sizeof(long) <<endl;
cout << "sizeOf(float) = " << sizeof(float) <<endl;
cout << "sizeOf(double) = " << sizeof(double) <<endl;
cout << "sizeOf(char) = " << sizeof(char) <<endl;
cout << "sizeOf(void) = " << sizeof(void) <<endl;
cout << "sizeOf(NULL) = " << sizeof(NULL) <<endl;
cout << "sizeOf(void *) = " << sizeof(void *) << " - (pointer)" << endl;
return 0;
}
Please notice that the size of data type are machine/system dependance!
No comments:
Post a Comment