   SDL Error
  I keep getting this error: Unhandled exception at 0x00c21b76 in Game.exe: 0xC0000005: Access violation reading location 0x00000004. When compiling this code. Some parts are directly from Lazy Foo's tutorial, I was just trying to get it to work. Here is the code:#include "SDL.h"#include "SDL_image.h"#include <string>//Screen attributesconst int SCREEN_WIDTH = 640;const int SCREEN_HEIGHT = 480;const int SCREEN_BPP = 32;//The attributes of the squareconst int SQUARE_WIDTH = 20;const int SQUARE_HEIGHT = 20;//The surfacesSDL_Surface *square = NULL;SDL_Surface *screen = NULL;//The event structureSDL_Event event;//The wallSDL_Rect wall;class Square{private:SDL_Rect box; int xVel, yVel; public: Square(); void handle_input(); void move(); void show(); };bool check_collision( SDL_Rect A, SDL_Rect B ) {int leftA, leftB; int rightA, rightB; int topA, topB; int bottomA, bottomB; leftA = A.x; rightA = A.x + A.w; topA = A.y; bottomA = A.y + A.h; leftB = B.x;rightB = B.x + B.w; topB = B.y; bottomB = B.y + B.h; if( bottomA <= topB ){ return false;} if( topA >= bottomB ) {return false;} if( rightA <= leftB ) { return false;} if( leftA >= rightB ) {return false;} return true; }void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL ){    //Holds offsets    SDL_Rect offset;    //Get offsets    offset.x = x;    offset.y = y;    //Blit    SDL_BlitSurface( source, clip, destination, &offset );}Square::Square() { box.x = 0;box.y = 0; box.w = SQUARE_WIDTH;box.h = SQUARE_HEIGHT;xVel = 0; yVel = 0; } void Square::handle_input(){    //If a key was pressed    if( event.type == SDL_KEYDOWN )    {   //Adjust the velocity   switch( event.key.keysym.sym )   {  case SDLK_UP: yVel -= SQUARE_HEIGHT / 2; break;  case SDLK_DOWN: yVel += SQUARE_HEIGHT / 2; break;  case SDLK_LEFT: xVel -= SQUARE_WIDTH / 2; break;  case SDLK_RIGHT: xVel += SQUARE_WIDTH / 2; break;   }    }    //If a key was released    else if( event.type == SDL_KEYUP )    {   //Adjust the velocity   switch( event.key.keysym.sym )   {  case SDLK_UP: yVel += SQUARE_HEIGHT / 2; break;  case SDLK_DOWN: yVel -= SQUARE_HEIGHT / 2; break;  case SDLK_LEFT: xVel += SQUARE_WIDTH / 2; break;  case SDLK_RIGHT: xVel -= SQUARE_WIDTH / 2; break;   }    }}void Square::move(){    //Move the square left or right    box.x += xVel;    //If the square went too far to the left or right or has collided with the wall    if( ( box.x < 0 ) || ( box.x + SQUARE_WIDTH > SCREEN_WIDTH ) || ( check_collision( box, wall ) ) )    {   //Move back   box.x -= xVel;    }    //Move the square up or down    box.y += yVel;    //If the square went too far up or down or has collided with the wall    if( ( box.y < 0 ) || ( box.y + SQUARE_HEIGHT > SCREEN_HEIGHT ) || ( check_collision( box, wall ) ) )    {   //Move back   box.y -= yVel;    }}void Square::show(){    //Show the square    apply_surface( box.x, box.y, square, screen );}int main( int argc, char *args[] ){SDL_Init( SDL_INIT_EVERYTHING );square = IMG_Load ("square.bmp");SDL_WM_SetCaption( "Yay!", NULL );Square mySquare;bool GameRunning = true;if (GameRunning == true){while ( SDL_PollEvent ( &event ) ){if ( event.type == SDL_QUIT ){GameRunning = false;}mySquare.move();SDL_FillRect( screen, &screen->clip_rect, SDL_MapRGB( screen->format, 0xFF, 0xFF, 0xFF ) );SDL_FillRect( screen, &wall, SDL_MapRGB( screen->format, 0x77, 0x77, 0x77 ) );mySquare.show();SDL_Flip( screen );}}else {SDL_FreeSurface( square );SDL_Quit();}return 0;}I would appreciate it if someone could help me. Oh and it's supposed to make a block collide with a wall.   
  You're trying to use a NULL pointer somewhere.  If that's the entirety of your code, then it's screen -- because you forgot to create it.screen = SDL_SetVideoMode(1024,768, 32, SDL_SWSURFACE|SDL_DOUBLEBUF );;  Oh my god thank you so much! I haven't coded in a month now and forgot this kinda stuff lol. Thanks again.   