请问这个C语言sizeof()问题怎么编程?表示从未学过,老师从未讲过,书本没有过叫我怎么写

请问这个C语言sizeof()问题怎么编程?表示从未学过,老师从未讲过,书本没有过叫我怎么写😂赏金不多,第一次来问😂

第1个回答  2017-10-16

sizeof是C/C++中的一个操作符(operator),简单的说其作用就是返回一个对象或者类型所占的内存字节数。

#include<stdio.h>

int main()
{
    printf("%d\n%d\n%d\n%d\n%d\n%d\n",sizeof(int),sizeof(float),sizeof(double),sizeof(short),sizeof(long int ),sizeof(long double));
}

追问

十分感谢!

第2个回答  2017-10-16
#include <stdio.h>
int main()
{
printf("%d\n",sizeof(char)); 
printf("%d\n",sizeof(short));
printf("%d\n",sizeof(int));
printf("%d\n",sizeof(long));
printf("%d\n",sizeof(float));
printf("%d\n",sizeof(double));

 return 0;
}

追问

谢谢!!

追答

不客气啦

本回答被提问者采纳
第3个回答  2017-10-16
跟学习好的聪明人做朋友,时间长点就有改观。当然得和他多探讨题目。追问

😃

相似回答