C to English Declarations


int f1;             // an int
int *f2;            // a pointer to an int
int f3[3];          // an array of 3 ints
int *f4[3];         // an array of 3 pointers to int
int (*f5)[3];       // a pointer to an array of 3 ints
int *(*f6)[3];      // a pointer to an array of 3 pointers to int
int f7[3][4];       // an array of 3 arrays of 4 ints (a 3x4 array of int)
int *f8[3][4];      // an array of 3 arrays of 4 pointers to int (a 3x4 array of pointer to int)
int (*f9)[3][4];    // a pointer to an array of 3 arrays of 4 ints (a pointer to 2 above)
int *(*f10)[3][4];  // a pointer to an array of 3 arrays of 4 pointers to int (a pointer to 2 above)
int (*f11[3])[4];   // an array of 3 pointers to an array of 4 ints 
int *(*f12[3])[4];  // an array of 3 pointers to an array of 4 pointers to int

void f21(void);                // a function taking nothing and returning nothing
void f22(int, float);          // a function taking an int and a float and returning nothing
void f23(int i, float f);      // a function taking an int and a float and returning nothing
int *f24(void);                // a function taking nothing and returning a pointer to an int
int (*f25)(void);              // a pointer to a function taking nothing and returning an int
int **f26(void);               // a function taking nothing and returning a pointer to a pointer to an int
int *(*f27)(void);             // a pointer to a function taking nothing and returning a pointer to an int
double *(*f28)(int, float *);  // a pointer to a function taking an int and a pointer to a float and returning a pointer to a double
int **(**f29)(void);           // a pointer to a pointer to a function taking nothing and returning a pointer to a pointer to an int

int f31()[];     // error C2090: function returns array
int *f31a[]();   // error C2092: array element type cannot be function
int (*f31b[])(); // correct, an array of pointers to functions returning int

int f32()();     // error: function returns function
int *f32a()();   // error: function returns function
int (*f32b())(); // correct, a function returning a pointer to a function returning an int

int f33[]();     // error: array element type cannot be function (array of funtions)
int *f33a[]();   // error: array element type cannot be function (array of funtions)
int (*f33b[])(); // correct, an array of pointers to functions returning an int

// a pointer to an array of 5 pointers to functions taking a pointer to a const char and an int 
// and returning a pointer to a BITMAP struct
struct BITMAP *(*((*f41)[5]))(const char *, int);

// a function taking a pointer to a pointer to a BITMAP struct and returning a pointer to an array 
// of 5 pointers to unsigned int
unsigned int *(*f42(struct BITMAP **))[5];

// a function taking a pointer to a char and an int and returning a pointer to an array of 5 pointers to int
int *(*foo(char *, int))[5];