command 2

博客介绍了C语言相关知识,包括不要轻易定义变量,可在.c文件定义并用extern标注使用全局变量;还说明了用VS在debug模式下对变量添加监视的方法;最后给出了#include <stdint.h>下不同类型变量的格式化输出方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.在c中,不要轻易定义变量,很容易造成重复定义的错误。现在一般在.c文件中定义变量,然后在需要使用的地方用extern标注,
就可以在当前文件下使用其他文件中定义好的全局变量。

2.用vs对变量添加监视:要在debug模式下,然后对变量所在的语句打断点,当程序运行到该语句,右击该变量->添加监视,
然后就可以在监视窗口看到该变量的实时的值了。

3.#include <stdint.h>

/* There is some amount of overlap with <sys/types.h> as known by inet code */   
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  

/* Unsigned.  */  
typedef unsigned char           uint8_t;  
typedef unsigned short int      uint16_t;  
typedef unsigned int            uint32_t;  
#if __WORDSIZE == 64  
typedef unsigned long int       uint64_t;  
#else  
__extension__  
typedef unsigned long long int  uint64_t;  
# endif

格式化输出:
unit64_t %llu
unit32_t %u
unit16_t %hu

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值