I've been looking at this for a while and I have some ideas on what this code could be doing, but I'm not sure if I correctly understand what the syntax of the code does.
The code iterates through a 2D array of unsigned chars, its meant to fill the array with 0's unless the spot in the array represents; the bottom, or the sides. If that is the case fill the spot in the array with a 9 instead.
The part I'm confused about is the statement (pField[y*fieldWidth + x] =
) I believe this is a conditional statement, I understand the logic after, my question is specifically about this conditional, how should it be interpreted using if statements if possible?, If its not a conditional statement, what kind of statement is it?
pField = new unsigned char[fieldWidth*fieldHeight]; // Create play field buffer
for (int x = 0; x < fieldWidth; x++) // Board Boundary
for (int y = 0; y < fieldHeight; y++)
pField[y*fieldWidth + x] = (x == 0 || x == fieldWidth - 1 || y == fieldHeight - 1) ? 9 : 0;