#include <iostream>
using namespace std;
int main()
{
//建立bool資料類型
bool flag = true;
cout << flag << endl;
//布爾類型所占的記憶體空間大小
cout << "布爾類型所占的記憶體空間大小: "<<sizeof(flag) << endl;
system("pause");
return 0;
}
運作結果:
#include <iostream>
using namespace std;
int main()
{
//建立bool資料類型
bool flag = true;
cout << flag << endl;
//布爾類型所占的記憶體空間大小
cout << "布爾類型所占的記憶體空間大小: "<<sizeof(flag) << endl;
system("pause");
return 0;
}
運作結果: