compiler: "variable was not declared in scope"

Two 7-segment displays must show a fixed number. The 7 segments are driven individually (common cathode) using a multiplexing method to drive both displays with 7 outputs for the segments and 2 outputs for each cathode.
The decimal is called in a function, the display for the decimals is driven, subsequently another function is called to drive the units.
A compile error is show for line 53: ‘number’ was not declared in this scope even though it was declared globally.

What do I overlook, what is wrong?

// https://create.arduino.cc/projecthub/KVLakshmiSri/00-to-99-on-seven-segment-displays-1ca7e0
// v2: instead of incrementing numbers display just one number
// pin9: common cathode singles, pin10: common cothode decimals
// 1=a, 2=b, 3=c, 4=d, 5=e, 6=f, 7=g, 8=dp
// common cathode: switching the cathode HIGH = display off
// outputs: a=1 b=2 c=3 d=4 e=5 f=6 g=7, no decimal point
#define commCath1 9
#define commCath10 10

void setup()
{
  for (int i = 1; i <= 10; i++) {
    pinMode(i, OUTPUT); //Set all pins from 1 to 10 as OUTPUT
}
  //Start with display off
  for (int thisPin = 1; thisPin <= 8; thisPin++) {
    digitalWrite(thisPin , HIGH);
  }
  // set common cathode HIGH, disable display
  for (int thisPin = 9; thisPin <= 10; thisPin++) {
    digitalWrite(thisPin , LOW);
  }

//The line below is the array containing all the binary numbers for the digits on a SSD from 0 to 9
const int number[10] = {0b01111111, 0b0000110, 0b1011011, 0b1001111, 0b1100110, 0b1101101, 0b1111101, 0b0000111, 0b1111111, 0b1101111};
}

void loop()
{
  display_tens(2); // display 2 as tens
}

void display_tens(const int tens)
{
  int LED10, a, ones;     
  //LED10 is just used to deal with pins of the 1st SSD which desplays the tens digit

  for (LED10 = 1, a = 0; LED10 <=7 ; LED10++, a++)
  {
    digitalWrite(LED10, bitRead(number[tens], a));
    digitalWrite(commCath1 , HIGH);
    digitalWrite(commCath10 , LOW);
  }

display_ones(5); // display 5 as units or ones
}

void display_ones(const int x)
{ int LED1, b;   //LED1 is de eenheden digit
  for (LED1 = 1, b = 0; LED1 <= 7; LED1++, b++)
  {
    digitalWrite(LED1, bitRead(number[x], b));
    digitalWrite(commCath1 , LOW);
    digitalWrite(commCath10 , HIGH);
 }
}

even though it was declared globally.

I see it declared in setup(), not globally

UKHeliBob:
I see it declared in setup(), not globally

I don’t understand: setting the array outside of setup makes it compile ok? Why?

// https://create.arduino.cc/projecthub/KVLakshmiSri/00-to-99-on-seven-segment-displays-1ca7e0
// v2: instead of incrementing numbers display just one number
// pin9: common cathode singles, pin10: common cothode decimals
// 1=a, 2=b, 3=c, 4=d, 5=e, 6=f, 7=g, 8=dp
// common cathode: switching the cathode HIGH = display off
// outputs: a=1 b=2 c=3 d=4 e=5 f=6 g=7, no decimal point
#define commCath1 9
#define commCath10 10

void setup()
{
  for (int i = 1; i <= 10; i++) {
    pinMode(i, OUTPUT); //Set all pins from 1 to 10 as OUTPUT
  }
  //Start with display off
  for (int thisPin = 1; thisPin <= 8; thisPin++) {
    digitalWrite(thisPin , LOW);
  }
  // set common cathode HIGH, disable display
  for (int thisPin = 9; thisPin <= 10; thisPin++) {
    digitalWrite(thisPin , HIGH);
  }
}
  //The line below is the array containing all the binary numbers for the digits on a SSD from 0 to 9
  const int number[10] = {0b01111111, 0b0000110, 0b1011011, 0b1001111, 0b1100110, 0b1101101, 0b1111101, 0b0000111, 0b1111111, 0b1101111};
  int unitLed = 5;
  int decLed = 2;


void loop()
{
  display_tens(decLed); // display 2 as tens
}

void display_tens(const int tens)
{
  int LED10, a, ones;
  //LED10 is just used to deal with pins of the 1st SSD which desplays the tens digit

  for (LED10 = 1, a = 0; LED10 <= 7 ; LED10++, a++)
  {
    digitalWrite(LED10, bitRead(number[tens], a));
    digitalWrite(commCath1 , HIGH);
    digitalWrite(commCath10 , LOW);
  }

  display_ones(unitLed); // display 5 as units or ones
}

void display_ones(const int x)
{ int LED1, b;   //LED1 is de eenheden digit
  for (LED1 = 1, b = 0; LED1 <= 7; LED1++, b++)
  {
    digitalWrite(LED1, bitRead(number[x], b));
    digitalWrite(commCath1 , LOW);
    digitalWrite(commCath10 , HIGH);
  }
}

don't understand: setting the array outside of setup makes it compile ok? Why?

Because that declares it globally, ie it is available throughout the program and not just in setup()

Scope of a variable is the lifetime and visibility a variable has in a program.

groundFungus:
Scope of a variable is the lifetime and visibility a variable has in a program.

Thanks! Stupid beginner's error.

groundFungus:
Scope of a variable is the lifetime and visibility a variable has in a program.

Scope is the visibility, extent is the lifetime. They are independent concepts, but often get confusedhttp://2ality.com/2011/05/programming-language-variables-scope.html

In some languages the difference between the two is more apparent than in C/C++, but locally
declared static variables in C have local scope and indefinite extent for instance.