首页 > 其他分享 >C语言数据类型对应字节

C语言数据类型对应字节

时间:2023-03-16 16:58:55浏览次数:59  
标签:__ typedef 字节 int 数据类型 unsigned long C语言 defined

基础类型

一个字节通常表示8bit

typedef类型

经常在代码中见到的uint32_t的t代表是由typedef产生的。

/* There is some amount of overlap with <sys/types.h> as known by inet code */
#ifndef __int8_t_defined
# define __int8_t_defined
typedef signed char             int8_t;
typedef short int               int16_t;
typedef int                     int32_t;
# if __WORDSIZE == 64
typedef long int                int64_t;
# else
__extension__
typedef long long int           int64_t;
# endif
# endif
/* Unsigned.  */
typedef unsigned char           uint8_t;
typedef unsigned short int      uint16_t;
#ifndef __uint32_t_defined
typedef unsigned int            uint32_t;
# define __uint32_t_defined
#endif
#if __WORDSIZE == 64
typedef unsigned long int       uint64_t;
#else
__extension__
typedef unsigned long long int  uint64_t;
#endif

参考链接

标签:__,typedef,字节,int,数据类型,unsigned,long,C语言,defined
From: https://www.cnblogs.com/xzh-personal-issue/p/17223246.html

相关文章