我在创建数组数组时遇到了麻烦。这是我的程序代码:
const unsigned char one[] PROGMEM = {
};
const unsigned char two[] PROGMEM = {
};
const unsigned char three[] PROGMEM = {
};
const unsigned char four[] PROGMEM = {
};
const unsigned char five[] PROGMEM = {
};
const unsigned char six[] PROGMEM = {
};
const unsigned char seven[] PROGMEM = {
};
const unsigned char eight[] PROGMEM = {
};
const unsigned char nine[] PROGMEM = {
};
const unsigned char array[] PROGMEM = {const unsigned char one[],const unsigned char two[],const unsigned char three[],const unsigned char four[],const unsigned char five[],const unsigned char six[],const unsigned char seven[],const unsigned char eight[],const unsigned char nine[]};
另外在我的另一个函数的void设置中:
const void make(int x, int y,const unsigned char array[], 67,67){
它给了我奇怪的错误,例如:
Mattplztestit:17: error: expected identifier before numeric constant
Mattplztestit:17: error: expected ',' or '...' before numeric constant
Mattplztestit:178: error: expected identifier before numeric constant
Mattplztestit:178: error: expected ',' or '...' before numeric constant
Mattplztestit.ino: In function 'const void make(int, int, const unsigned char*, int)':
Mattplztestit:179: error: expected initializer before '<=' token
Mattplztestit:179: error: expected ';' before '<=' token
Mattplztestit:179: error: expected primary-expression before '<=' token
Mattplztestit.ino: In function 'void constr(int)':
Mattplztestit:193: error: too many arguments to function 'const void make(int, int, const unsigned char*, int)'
Mattplztestit.ino:178:12: note: declared here
Mattplztestit:194: error: expected ';' before '}' token
数字常量之前的预期标识符
有人可以帮忙吗?
三江源
答案 0 :(得分:2)
如果你read a good beginners book它会告诉你数组衰减指向它们的第一个元素,这意味着你可以有一个指针数组,并用指向其他数组的指针填充它。
像
这样的东西const unsigned char* array[] PROGMEM = {
one,
two,
// And so on...
};
答案 1 :(得分:0)
您应该将const unsigned char array []更改为const unsigned char