Original Post
I'm trying to get the color value of a pixel from an SDL surface, and I found it has to be done this way: Uint8 *p = (Uint8 *)img->pixels + y * img->pitch + x * 4; Uint32 color = *(Uint32 *)p; But whenever I want to use the variable color, the program crashes! And if I set another variable to color, it doesn't crash, but if I then use that other variable, it crashes again! What's happening here? Thanks!