Originally Posted by man XOpenDisplay
If successful, XOpenDisplay() returns a pointer to a Display structure, which is defined in X11/Xlib.h. If XOpenDisplay() does not succeed, it returns NULL. After a successful call to XOpenDisplay() all of the screens in the display can be used by the client. The screen number specified in the display_name argument is returned by the DefaultScreen() macro (or the XDefaultScreen() function). You can access elements of the Display and Screen structures only by using the information macros or functions. For information about using macros and functions to obtain information from the Display structure, see Display Macros.