Napisałem sobie prosty kod:
#include <iostream>
using namespace std;
int main()
{
cout << "bool - " << sizeof(bool) << endl;
cout << "char - " << sizeof(char) << endl;
cout << "string - " << sizeof(string) << endl;
cout << "int - " << sizeof(int) << endl;
cout << "long int - " << sizeof(long int) << endl;
cout << "float - " << sizeof(float) << endl;
cout << "double - " << sizeof(double) << endl;
cout << "long double - " << sizeof(long double) << endl;
cout << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Teraz pytanie. Szukam w rożnych źródłach i różnie podają. Czy sizeof() zwraca rozmiar w bitach czy w bajtach ?