a.h extern Quiet_motor_Info_t motor_info; // 声明为全局变量
#ifndef __A__H__
#define __A__H__
typedef struct {
int motor_end_flg; // 电机结束标志位 A端1 B端2
int angle_count; // 角度计数器
int motor_run_dir; // 电机运行方向
} Quiet_motor_Info_t;
extern Quiet_motor_Info_t motor_info; // 声明为全局变量
int

文章讲述了在C语言中如何声明和使用全局变量,具体涉及一个名为Quiet_motor_Info_t的结构体类型,包含电机结束标志位、角度计数器和电机运行方向等字段。在a.h头文件中声明全局变量,在a.c和b.c源文件中分别进行初始化和函数调用。同时,文章还提及了条件编译的概念,通过DEBUG宏定义控制调试模式的输出。
最低0.47元/天 解锁文章
1818

被折叠的 条评论
为什么被折叠?



