English to C Declarations


int g1;                 /* an int                                                                    */
int *g2;                /* a pointer to an int                                                       */
int g3[3];              /* an array of 3 int                                                         */
int *g4[3];             /* an array of 3 pointers to int                                             */
int (*g5)[3];           /* a pointer to an array of 3 ints                                           */
int *(*g6)[3];          /* a pointer to an array of 3 pointers to int                                */
int *(*g7)[3][5];       /* a pointer to an array of 3 arrays of 5 pointers to int                    */
int *(*(*g8)[3])[5];    /* a pointer to an array of 3 pointers to an array of 5 pointers to int      */
void (*g9[5])(int);     /* an array of 5 pointers to functions that take an int and return nothing   */
double *g10(int, int);  /* a function taking an int and an int and returning a pointer to a double   */
int (*g11(void))[10];   /* a function that takes nothing and returns a pointer to an array of 10 int */

/* a function that takes a pointer to an array of 3 doubles and returns a pointer to a function  */
/* that takes nothing and returns a float */
float (*g12(double (*) [3]))(void);

/* a function that takes a pointer to a pointer to an int and returns a pointer to an */
/* array of 5 pointers to functions that take a pointer to a const char and return an int */
int (*(*g13(int **))[5])(const char *);