如何解决下标值既不是数组也不是指针错误
我在头文件(Variables.h)中拥有此文件:
#ifndef VARIABLES_H
#define VARIABLES_H
#define NUM 99
#define BOOL 193
#define FLOAT 12
struct bools{
char name[100];
bool state;
}bool_dataPoints[BOOL];
struct floats{
char name[100];
float q;
}float_dataPoints[FLOAT];
struct nums{
char name[100];
unsigned int q;
}num_dataPoints[NUM];
...
我正在尝试使用此指令(位于单独的C文件中):
#include "xc.h"
#include <stdbool.h>
#include <stdlib.h>
#include <stddef.h>
#include "Variables.h"
if(bool_dataPoints[147].state){//I_EStop
...
但是我在“ if”行代码中遇到此错误:
error: subscripted value is neither array nor pointer
解决方法
我发现,原型/声明中的参数与实现中的参数不匹配。我没有包括参数数据类型。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。