gpt4 book ai didi

c - Arduino 中的数组数组

转载 作者:太空宇宙 更新时间:2023-11-04 02:34:35 25 4
gpt4 key购买 nike

我在创建数组数组时遇到问题。这是我的程序代码:

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

数字常量之前的预期标识符

有人可以帮忙吗?

谢谢

最佳答案

如果你read a good beginners book它会告诉您数组衰减为指向其第一个元素的指针,这意味着您可以拥有一个指针数组,并用指向其他数组的指针填充它。

有点像

const unsigned char* array[] PROGMEM = {
one,
two,
// And so on...
};

关于c - Arduino 中的数组数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39194157/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com