struct type_size_t { char *type; int size; } type_size[] = { { "char", sizeof(char) }, { "int", sizeof(int) }, { "long", sizeof(long) }, { "long long", sizeof(long long) }, { "short int", sizeof(short int) }, { "unsigned short int", sizeof(unsigned short int) }, { NULL, 0 } }; |
原帖由 wxj120bw 于 2008-10-19 19:47 发表
只想得到数据类型的大小 只不过数据类型关键字放到程序的参数 比如 程序名 data 运行 ./data int 得到整形int的大小为4 不知道能否实现
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |