Code RoomLoop bounds exceed array size
EasyPrep Room Coding #2006

Loop bounds exceed array size

Code reviewAlgorithms & data structuresMid–Senior~16 min

Review this C++ code copying a row of a fixed-size tile into a scanline.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 16 min
Mark a line and say what kind of problem it is.0 findings
1constexpr int W = 64;
2struct Tile { uint8_t px[W]; };
3 
4void blit(const Tile& t, uint8_t out[W]) {
5 for (int x = 0; x <= W; ++x) { // copy the row
6 out[x] = t.px[x];
7 }
8}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.