title: C and SDL quit from function
body: <p>I use C and SDL 2.0, but i have a problem, this(when you click on the window's "x" it quits):</p>
  
  <pre><code>void function(SDL_Surface *screen) {
    SDL_Event event;
    bool quit=false;
      while (!quit) {
              SDL_WaitEvent(&amp;event);
  
              switch (event.type) {
                 case...
  
                 case SDL_QUIT:    
                    quit = true;        
                    break;
              }
  }
  </code></pre>
  
  <p>This is working, but not well. If this is in a function like this, it quits only to the main(), so I need to click on "x" again to quit from the whole program.
  How can I solve it? (I want to quit from the whole program everytime, does not matter if it's in a function or not).</p>