Triple Nested For loop (C++) [closed]

i is not initialised before it’s read. That’s undefined behaviour. Didn’t your compiler warn you of this?

Simple fix: use for (int i = 0; /*etc*/;

Leave a Comment