【发布时间】:2020-09-28 14:00:43
【问题描述】:
我在头文件(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
【问题讨论】:
标签: arrays pointers struct compiler-errors