Arduino 上的结构:function() 'does not name a type'

struct on Arduino: function() 'does not name a type'

我为变量和函数编写了一个结构,但对我来说不起作用。我很困惑...

struct Array2 {
    int array[2] = {0, 1};
};

Array2 Digit2Arr2(int x) {
  Array2 v;
  if (x > 9) {
    int y;
    y=x/10; v.array[1]=x-(10*y); x=y;
    y=x/10; v.array[0]=x-(10*y); x=y;
  } else {
    v.array[0] = 0;
    v.array[1] = x;
  }
  return v;
}

'Array2' does not name a type

强烈建议您阅读如何创建结构。

您可以从这里开始:

https://www.learncpp.com/cpp-tutorial/47-structs/

您在创建结构时的语法错误。

struct Array2 {
   int array[2] = {0, 1}; 
};