How can i run Geaphical Software without Desktop Environment

Hi !
I wanted to run the graphical C source code without Desktop Environment !

For example, please look at this code :

#include <gtk/gtk.h>

int main(int argc, char *argv[]) {

  GtkWidget *window;

  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_show(window);
  

  gtk_main();

  return 0;
}

but it has Error !

it cant run in fedora without Desktop Environment !

Error is :

[MARSL@marsl ~]$ ./gtk_example_code
(gtk :6616): Gtk_WARNING **: 10:43:49.667: cannot open display:

but this code can run in Desktop Environment .
So how do desktops like GNOME that are made with GTK work?

and sorry for bad English !