uint8_t / uint16_t / uint32_t /uint64_t解释

时间:2021-09-02 16:45:21   收藏:0   阅读:40
#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   
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   
uint16_t %hu  
uint32_t %u  
uint64_t %llu  
uint8_t num = 67;  
cout << num << endl;  // 结果是C

uint8_t实际上是一个char。所以输出uint8_t类型的变量实际上输出其对应的字符,而不是数值。

原文:https://www.cnblogs.com/lodger47/p/15217393.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!