+ 1
[c++] Why the following code is working ?
why the code is working fine ? goto: https://code.sololearn.com/cA9a25a96A09
3 Answers
+ 3
https://stackoverflow.com/questions/23843760/how-is-char-array-an-oversize-when-filled-by-cin-geta-size
+ 2
Your program is showing an undefined behaviour.
C++ doesn't specify what to do when a program tries to access values outside the limit of arrays, so the behaviour of the program can't be determined there.
+ 1
5 elements of 5 bytes each 23 is just 1 element out of 5 The one-dimensional array can hold 5 elements.đ