[good]c语言中各种类型

复制代码
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <ctype.h>
#include <locale.h>
#include <setjmp.h>
#include <signal.h>
#include <errno.h>
#include <stddef.h>
#include <wchar.h>
#include <wctype.h>
#include <stdint.h>

// typedef signed char int8_t;
// typedef short int16_t;
// typedef int int32_t;
// typedef long long int64_t;
// typedef unsigned char uint8_t;
// typedef unsigned short uint16_t;
// typedef unsigned int uint32_t;
// typedef unsigned long long uint64_t;

#define print_size(x) printf("the size of %s is : %zu\n", #x, sizeof(x));

typedef struct
{
    double a;
    int x;
    char c;
    char *name;
} str_ex;

typedef enum
{
    MON,
    TUE,
    WED,
    THU,
    FRI,
    SAT,
    SUN
} enum_ex;

int main(int argc, char *argvc[])
{
    print_size(int8_t);
    print_size(int16_t);
    print_size(int32_t);
    print_size(int64_t);
    print_size(uint8_t);
    print_size(uint16_t);
    print_size(uint32_t);
    print_size(char);
    print_size(short int);
    print_size(unsigned short int);
    print_size(unsigned int);
    print_size(int);
    print_size(long int);
    print_size(unsigned long int);
    print_size(long long int);
    print_size(unsigned long long int);
    print_size(signed char);
    print_size(unsigned char);
    print_size(float);
    print_size(double);
    print_size(long double);
    print_size(char *);
    print_size(short int *);
    print_size(unsigned short int *);
    print_size(unsigned int *);
    print_size(int *);
    print_size(long int *);
    print_size(unsigned long int *);
    print_size(long long int *);
    print_size(unsigned long long int *);
    print_size(signed char *);
    print_size(unsigned char *);
    print_size(float *);
    print_size(double *);
    print_size(long double *);

    print_size(str_ex);
    print_size(enum_ex);
}
复制代码

 

posted on   风中狂笑  阅读(9)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示