1. 背景说明
广度优先通俗的解释的是将当前所有能走的步骤全部走完并保存在队列中,又称为层序遍历。此外,该方法类似于多条路线并发前进,哪一条先到就取哪条路线作为结果并终止查询,因此能够得到最短路径,缺点是由于遍历的点太多,效率低下。
2. 示例代码
1)errorRecord.h
// 记录错误宏定义头文件
#ifndef ERROR_RECORD_H
#define ERROR_RECORD_H
#include <stdio.h>
#include <string.h>
#include <stdint.h>
// Extracts the file name from the file path
#define FILE_NAME(X) strrchr(X, '\\') ? strrchr(X, '\\') + 1 : X
// Define DEBUG macro for enabling debug mode
#define DEBUG
// Print error message
#ifdef DEBUG
#define ERR