Every time I run the below program, it always 'stops responding' in a few seconds, or if I click it. Which ever comes first. It does what it is supposed to do (display a dot in the corner). It returns -805306369 (0xCFFFFFFF), but not in the build log; it returns this in console. Why is it freezing? How do I fix this?
#include <SDL/SDL.h>
constint SCREEN_WIDTH = 640;
constint SCREEN_HEIGHT = 480;
constint SCREEN_DEPTH = 32;
int main(int argc, char *argv[]) {
SDL_Surface *screen;
Uint8 *p;
int x = 10; //x coordinate of our pixel
int y = 20; //y coordinate of our pixel
/* Initialize SDL */
SDL_Init(SDL_INIT_VIDEO);
/* Initialize the screen / window */
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_DEPTH, SDL_SWSURFACE);
/* Make p point to the place we want to draw the pixel */
p = (Uint8 *)screen->pixels + y * screen->pitch + x * screen->format->BytesPerPixel;
/* Draw the pixel! */
*p=0xff;
/* update the screen (aka double buffering) */
SDL_Flip(screen);
while(true);
}