Segmentation Fault in C but not in C++?

Hi, I’m relatively new to SDL and I’ve been following LazyFoo’s guide. I tried programming it in C instead of C++ and it actually compiles without any problems but when I attempt to run it, it just throws me a seg fault. I saved it as C++ and it ran without any problems. What am I doing wrong?

#include<stdio.h>
#include<SDL2/SDL.h>
#define HEIGHT 720
#define WIDTH 1280

int initWindow(SDL_Window **window);
int loadMedia(SDL_Surface **surface);
void update(SDL_Window **window, SDL_Surface **image, SDL_Surface **surface);
void close(SDL_Window **window);

int main(int argc, char *argv[])
{
    SDL_Window *window;
    SDL_Surface *surface, *image;
    
    window = NULL;
    surface = NULL;
   
    if(SDL_Init(SDL_INIT_VIDEO) != 0){
        printf("Error: %s", SDL_GetError());
    }else{
        if(initWindow(&window) != 0){
            printf("Error: %s", SDL_GetError());
        }else{
            surface = SDL_GetWindowSurface(window);
            SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, 0xFF, 0xFF, 0xFF));
            if(loadMedia(&image) != 0){
                printf("Error: %s", SDL_GetError());
            }else{
                update(&window, &image, &surface);
            }
        }
    }
}

int loadMedia(SDL_Surface **image)
{
    *image = SDL_LoadBMP("assets/hello.bmp");
    return (*image == NULL) ? 1: 0;
}

void update(SDL_Window **window, SDL_Surface **image, SDL_Surface **surface)
{
    int isOver;
    SDL_Event e;
    
    isOver = 0;
    
    while(!isOver){
        while(SDL_PollEvent(&e) != 0){
            if(e.type == SDL_QUIT){
                isOver = 1;
            }
        }
        
        SDL_BlitSurface(*image, NULL, *surface, NULL);
        SDL_UpdateWindowSurface(*window);
    }

    close(window);
}

int initWindow(SDL_Window **window)
{
    *window = SDL_CreateWindow("Window", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
    
    return (*window == NULL) ? 1: 0;
}

void close(SDL_Window **window)
{
    SDL_DestroyWindow(*window);
    SDL_Quit();
}

Start from where it crashes, what gdb says. gdb says this

https://s14-eu5.ixquick.com/wikioimage/73043fb8578391655c5b29fb8ba0cb8a.png

Program received signal SIGSEGV, Segmentation fault.
0x0000000000400d13 in close (window=0x3) at sdltest.c:72
72          SDL_DestroyWindow(*window);

------------------------
kiss_sdl - Simple generic GUI widget toolkit for SDL2 https://github.com/actsl/kiss_sdl

Try renaming your close() function. See also https://bugzilla.libsdl.org/show_bug.cgi?id=3530

Enable compiler warnings on and fix those. Your main() is missing a return.