#include
#include
int main()
{ char ch = 'a';
short int sh =5 ;
int x = 10;
long int l = 20;
long long ll = 40;
float f = 30.21;
double d = 312.009;
double ld = 1097.8076;
sizeof(d);
printf("char soze is :%d\n",sizeof(ch));
printf("short size is :%d\n",sizeof(sh));
printf("int size is :%d\n",sizeof(x));
printf("long int size is :%d\n",sizeof(l));
printf("long long size is :%d\n",sizeof(ll));
printf("float size is :%d\n",sizeof(f));
printf("double size is :%d\n",sizeof(d));
printf("long double size is :%d\n",sizeof(ld));
exit(0);
}
//错误很多,自己对一下
char ch = 'a';
short int sh = 's';//s目前在这里看不到它的声明,如果你想将字符s的ASCII码给sh,加上单引号。
int x = 10;
long int l = 20;
long long ll = 40;
float f = 30.21;
double d = 312.009;//请加上语句结束标志分号
long double ld = 1097.8076;//请加上语句结束标志分号
sizeof(d);
printf("char soze is :%d\n",sizeof(ch));
printf("short size is :%d\n",sizeof(sh));
printf("int size is :%d\n",sizeof(x));
printf("long int size is :%d\n",sizeof(l));
printf("long long size is :%d\n",sizeof(ll));
printf("float size is :%d\n",sizeof(f));
printf("double size is :%d\n",sizeof(d));
printf("long double size is :%d\n",sizeof(ld));
exit(0);//请加上语句结束标志,分号
#include
int main()
{
char ch = 'a';
short int sh = 's';
int x = 10;
long int l = 20;
long long ll = 40;
float f = 30.21;
double d = 312.009 ;
long double ld = 1097.8076 ;
sizeof(d);
printf("char soze is :%d\n",sizeof(ch));
printf("short size is :%d\n",sizeof(sh));
printf("int size is :%d\n",sizeof(x));
printf("long int size is :%d\n",sizeof(l));
printf("long long size is :%d\n",sizeof(ll));
printf("float size is :%d\n",sizeof(f));
printf("double size is :%d\n",sizeof(d));
printf("long double size is :%d\n",sizeof(ld));
exit 0 ;
}
你是刚学的C吧,全市语法错误呀。这个gcc 可编译成功。你试试。
short int sh = s;
s是什么东东?
还有提问时记得告诉大家你的编译出错的信息,这样便于大家帮你查错