How could it be possible to read and write past the array

后端 未结 3 2053
一整个雨季
一整个雨季 2020-12-12 05:42

Output of the program:

#include 

int main()
{
    int size;

    printf(\"Enter the size of array: \");
    scanf(\"%d\",&size);

    i         


        
3条回答
  •  一整个雨季
    2020-12-12 06:26

    By reading and writing past the array, your program invokes undefined behavior. It doesn't mean that it has to crash or print garbage values, it can pretend working fine. Apparently, that's what is happening in this case.

提交回复
热议问题