In the code, you didn't account for x and y needing to move 4 bytes, since every pixel is 4 bytes, but in your array, it's going through it byte by byte.
for(int x = 0; x < 800; x++)
{
for(int y = 0; y < 600; y++)
{
pixels[(y * x)*4] = 255; // R?
pixels[(y * x)*4 + 1] = 255; // G?
pixels[(y * x)*4+ 2] = 255; // B?
pixels[(y * x)*4 + 3] = 255; // A?
}
}
Made the minor adjustments. This may be more favourable