struct T {
char a;
int b;
char c;
};
struct E {
};
printf(
"%d\n",
sizeof(
struct T));
printf(
"%d\n",
sizeof(
struct E));
printf(
"%d\n",
sizeof(
char));
printf(
"%d\n",
sizeof(
short int));
printf(
"%d\n",
sizeof(
int));
printf(
"%d\n",
sizeof(
long));
printf(
"%d\n",
sizeof(
long long));
printf(
"%d\n",
sizeof(
float));
printf(
"%d\n",
sizeof(
double));
printf(
"%d\n",
sizeof(
long double));
printf(
"%d\n",
sizeof(
void));
printf(
"%d\n",
sizeof(
void*));
printf(
"%d\n",
sizeof(size_t));
printf(
"%d\n",
sizeof(
struct T));
printf(
"%d\n",
sizeof(
struct E));
printf(
"%d\n",
sizeof(
short int));
printf(
"%d\n",
sizeof(
int));
printf(
"%d\n",
sizeof(
long));
printf(
"%d\n",
sizeof(
long long));
printf(
"%d\n",
sizeof(
float));
printf(
"%d\n",
sizeof(
double));
printf(
"%d\n",
sizeof(
long double));
printf(
"%d\n",
sizeof(
void*));
printf(
"%d\n",
sizeof(size_t));
类型Linux x86Linux x64Win x86Win x64
struct T12121212struct E0011char1111short int2222int4444long4844long long8888float4444double8888long double121688void11--void*4848size_t4848
类型format
char%csigned char%c (or %hhi for numerical output)unsigned char%c (or %hhu for numerical output)shortshort intsigned shortsigned short int%hiunsigned shortunsigned short int%huintsignedsigned int%i or %dunsignedunsigned int%ulonglong intsigned longsigned long int%li or %ldunsigned longunsigned long int%lulong longlong long intsigned long longsigned long long int%lli or %lldunsigned long longunsigned long long int%llufloat%f (promoted automatically to double for printf())double%f (%F)(%lf (%lF) for scanf())%g %G%e %Elong double%Lf %LF%Lg %LG%Le %LE
转载请注明原文地址: https://ju.6miu.com/read-673651.html