문제

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;
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top