C语言程序查找int、float、double和char的大小。

296 阅读1分钟

写一个C语言程序来查找int或整数、float、double和char或字符的大小,并举例说明。在C语言编程中,我们有一个sizeof运算符,它允许我们打印或获得任何数据类型的大小。

#include <stdio.h>

int main() {  
printf("一个字符的大小= %ld Byte", sizeof(char))。  


printf("\\nSize of an Integer  = %ld Byte", sizeof(int));

printf("\\nSize of a Float     = %ld Byte", sizeof(float));

printf("\\nSize of a Double    = %ld Byte\\n", sizeof(double));

return 0;

image.png