Array out of bounds infinite loop problem!

Table of contents

Out-of-bounds infinite loop code:

Result:​Edit

Cause Analysis:


Out-of-bounds infinite loop code:


#include <stdio.h>

int main()
{
    int i = 0;
    int arr[] = { 1,2,3,4,5,6,7,8,9,10 };
    for (i = 0; i <= 12; i++)
    {
        arr[i] = 0;
        printf("hello bit\n");
    }
    return 0;
}


result:




Cause Analysis:

 



Guess you like

Origin blog.csdn.net/2301_77509762/article/details/130809602