Size Of Variable Types
Another simple program…to determine the exact size of data types on your computer (output may vary):
#include <iostream.h> int main(){ cout << "The size of an int is:\t\t" << sizeof(int) << " bytes.\n"; cout << "The size of a short is:\t\t" << sizeof(short) << " bytes.\n"; cout << "The size of a long is:\t\t" << sizeof(long) << " bytes.\n"; cout << "The size of a char is:\t\t" << sizeof(char) << " bytes.\n"; cout << "The size of a float is:\t\t" << sizeof(float) << " bytes.\n"; cout << "The size of a double is:\t" << sizeof(double) << " bytes.\n"; return 0; }
page revision: 0, last edited: 13 Oct 2007 06:46