c语言中如何求数据类型
可以使用sizeof运算符来求数据类型的大小,如:
#include <stdio.h>
int main() {
printf("Size of int: %d bytes\n", sizeof(int));
printf("Size of float: %d bytes\n", sizeof(float));
printf("Size of double: %d bytes\n", sizeof(double));
printf("Size of char: %d bytes\n", sizeof(char));
return 0;
}
输出结果:
Size of int: 4 bytes
Size of float: 4 bytes
Size of double: 8 bytes
Size of char: 1 bytes
原文地址: http://www.cveoy.top/t/topic/bF71 著作权归作者所有。请勿转载和采集!