I have got a strange behaviour in my C++ code in VS19. I have the following code:
bool tru;
int ax[3] = { 1,2,3 };
int val = ax[5];
tru = (ax[5] == 1);
When I run this I get:
I would expect to get an error in line 3 but I get a[5] = 0xcccccccc
. In this case tru = false would be correct. I have been using Qt Creator before which would crash in this case.
Can someone explain this behavior of Vs2019 to me?