Show toolbar

2014年7月2日 星期三

Variable type and size

標題:變數型態與大小
VC++ (datatype.cpp):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//Chapter 1 - datatype
#include <iostream>
using namespace std;
int main(void)
{
cout << "type\tbyte" << endl;
cout << "int\t" << sizeof(int) << endl; //4
cout << "long\t" << sizeof(long) << endl; //4
cout << "float\t" << sizeof(float) << endl; //4
cout << "double\t" << sizeof(double) << endl; //8
cout << "char\t" << sizeof(char) << endl; //1
cout << "bool\t" << sizeof(bool) << endl; //1
system("pause");
return 0;
}

說明:
基本的變數型態與大小

沒有留言:

張貼留言