#include <stdio.h>int main(int argc, char *argv[]){ int arr[5] = {1, 2, 3, 4, 5}; arr[6] = 7; // [1, 2, 3, 4, 5, 6] printf("arr[6] = %d\n", arr[6]); return 0;}
As I recall, it used to give a warning message when compiling and an unknown value when running.(Or I could see a Segment Fault message).
So I would like to know from which version the code above started working correctly.
My current GCC version is as follows:
gcc-13 (Homebrew GCC 13.2.0) 13.2.0Copyright (C) 2023 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.