我该如何解决这个超限?

how do i fix this overrun?

越界写入。 出现超限错误。

    > #define FLOORSNUMBER             128 
    > #define ILAFLOORSNUMBER          40
    > #else
    > #define ILAFLOORSNUMBER          40
    > 
    > uint8 downCallSide[ILAFLOORSNUMBER]; extern uint16  
    > callLightTimerAside[FLOORSNUMBER]; extern uint16  
    > callLightTimerBside[FLOORSNUMBER];



    for(i = 0;i <= FLOORSNUMBER;i++)
              {
                    
    **CID 18019 (#1 of 3): Out-of-bounds write (OVERRUN)
     overrun-local: Overrunning array ilaByPass.downCallSide of 40 bytes at byte offset 128 using index i (which evaluates to 128)**

ilaByPass.downCallSide[i] = OFFSTATE;
             
        #ifndef NA 
            
        **CID 17746 (#1 of 3): Out-of-bounds write (OVERRUN)**
        **overrun-local: Overrunning array callLightTimerAside of 128 2-byte elements at element index 128 (byte offset 257) using index i (which evaluates to 128).**

callLightTimerAside[i] = OFFSTATE;
                

我知道当我们尝试downcallside[i]时会出现溢出,因为i的值上升到128而downcallside的大小只有40。我该如何解决?

对于callLightTimerAside[i],大小看起来和floornumber一样,但是还是有超限。

这是一些看起来很奇怪的 C。不太确定发生了什么,但是

for(i = 0;i <= FLOORSNUMBER;i++)

这几乎可以肯定是一个错误。您遍历索引 0-128,而您声明的数组长度为 128,索引为 0-127。第128个索引不存在

尝试

for (i = 0; i < FLOORSNUMBER; i++)