diff --git a/try/c/data_types.c b/try/c/data_types.c index 433454c..634bcb2 100644 --- a/try/c/data_types.c +++ b/try/c/data_types.c @@ -1,19 +1,5 @@ -#include -#include -// DR data types -// 一些用于直观感受类型字节长度的数据类型 -// 看着舒服而已( -#define int8 char -#define int16 short -#define int32 int -#define int64 long long -#define uint8 unsigned char -#define uint16 unsigned short -#define uint32 unsigned int -#define uint64 unsigned long long -#define float32 float -#define float64 double +#include"utils.h" struct part { @@ -25,6 +11,6 @@ struct part int main(){ long double a = 1.0; // 输出 a 的字节长度 - printf("%o\n", sizeof(long double)); + printf("%d\n", sizeof(long double)); } diff --git a/try/c/utils.h b/try/c/utils.h new file mode 100644 index 0000000..dcef21f --- /dev/null +++ b/try/c/utils.h @@ -0,0 +1,19 @@ +// by shenjackyuanjie + +// 基本的头文件引用 +#include +#include + + +// 一些用于直观感受类型字节长度的数据类型 +// 看着舒服而已( +#define int8 char +#define int16 short +#define int32 int +#define int64 long long +#define uint8 unsigned char +#define uint16 unsigned short +#define uint32 unsigned int +#define uint64 unsigned long long +#define float32 float +#define float64 double \ No newline at end of file