Question

I have a very simple question, what are these declarations in the beginning of this C program called? Normally in a C program you list the <variable-type> <variable-name>, and optionally the <variable-value>. But in the first few lines of this program it seems it goes; <random-word> <variable-name>;

what is this syntax called? So I can learn more about it..

#include<X11/Xlib.h>

#include<stdio.h>
#include<stdlib.h>

int main()
{
    Display *dpy;
    Window rootwin;
    Window win;
    Colormap cmap;
    XEvent e;
    int scr;
    GC gc;
Was it helpful?

Solution

They're simply types defined in the X11/Xlib.h header file, the main head file for Xlib. It's the one you include when you want everything.

For example, under Debian, the Xlib.h file contains:

typedef struct _XDisplay Display;

after defining a (rather large) struct _XDisplay.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top