Why this code causes an infinite loop? Why the output is like this? Is this an undefined behavior of compiler?
I think it's an undefined behavior of compiler, but my main question is why it won't happen with a of size 5 and 10 times iteration. I changed the size of a and iteration number, but with this specific numbers causes infinite loop. https://code.sololearn.com/cUH9r4tcAwMX/?ref=app