Why shiftOut works when an inexisting position of an array is sent out?

Following code works fine, but I do not understand why.
The array contains 10 items, the index for the counter is 16; for counter > 10, which value of the array is getting to sent out?

byte seven_seg_digits_dec[] = { B11111100,  // = 0
                                B01100000,  // = 1
                                B11011010,  // = 2
                                B11110010,  // = 3
                                B01100110,  // = 4
                                B10110110,  // = 5
                                B10111110,  // = 6
                               B11100000,  // = 7
                                B11111110,  // = 8
                                B11100110,   // = 9
                              };
void loop() {
  for (int bin = 0b0000; 16 > bin; bin++)
  {
   
 
      digitalWrite(latchPin1, LOW);
      shiftOut(dataPin1, clockPin1, LSBFIRST, seven_seg_digits_dec[bin]);
      digitalWrite(latchPin1, HIGH);
}

Some randomly stored bits in some memory address that is not being used by another thingie. Call it luck that things did not go poo!.

C++ does not check array boundaries. It is the responsibility of the programmer not to access beyond array boundaries. If you do so anyway, it's a coincidence what happens.

You cannot be shure about that. Usually you will get a conflict with another 'thingie'

So far the OP has got lucky on that point.

Yes, he's got lucky because he only reads from that array. If you also write to it ...

Which may be the next posting.

Help I made a 5 element array and when I write to element 6, my MCU crashes.

Even worse: :wink:
Help I made a 5 element array and when I write to element No. 5, my MCU crashes.

Ok, we should not hijack this topic. But neverless I think @homer_simpson-25 should read everything carfully ...