Frame limiting in an SDL game
Code does not handle "wrap-around" correctly.

2 ^ 32 is the exclusive-or of 32 and 2.  That has the value of 34.  Instead, as unsigned math is defined to wrap-around, just subtract.

//if (endtime &gt; starttime) {
//    deltatime = endtime - starttime;
//} else {
//    deltatime = ((2 ^ 32) - starttime) + endtime;
//}

deltatime = endtime - starttime;


Missing objects

event, appisrunning, renderer, window are not obviously declared before use in SDL_PollEvent(&amp;event);.  Perhaps an SDL thing?

Unnecessary use of global variables

Uint32 starttime, endtime, deltatime; belongs in main().  Or even better, within the loop.

Use an auto formatter

The below code hints at manual formatting.  Use an auto formatter and save time.

 // render stuff here
 endtime = GetTickCount();
    if (endtime &gt; starttime)


An auto formatter would have the below and constant indent amount per level (rather than 2 and sometimes 4 spaces).

Example re-format

#include &lt;stdio.h&gt;
#include &lt;stdbool.h&gt;
#include "SDL.h"
#include "Windows.h"

#define WIN32_LEAN_AND_MEAN
#define FPS 30

int main(void) {
  timeBeginPeriod(1);
  while (appisrunning) {
    Uint32 starttime = GetTickCount();
    SDL_PollEvent(&amp;event);

    if (event.type == SDL_QUIT) {
      SDL_DestroyRenderer(renderer);
      SDL_DestroyWindow(window);
      SDL_Quit();
      appisrunning = false;
      break;
    }

    Uint32 endtime = GetTickCount();
    Uint32 deltatime = endtime - starttime;

    if (deltatime &gt; (1000 / FPS)) {
    } else {
      Sleep((1000 / FPS) - deltatime);
    }
  }
  timeEndPeriod(1);
  return 0;
}