Complex Declarations
Some Worked Examples
(Class Notes, 9th Feb 99)
Below are some examples of declarations in C. Try to work out for
yourself what each one means. See if you can work out what (sizeof abc)
will be in each case; that can aid understanding too.
Then click the "answer" link to see the solution.
1. answer
char *abc[100];
2. answer
char (*abc)[100];
3. answer
char (*abc)[];
4. answer
char abc[120][80];
5. answer
char abc(int x);
6. answer
char *abc(int x);
7. answer
float (*abc)(float x);
8. answer
float (*abc[3])(float x);
9. answer
float (*abc[3])(float);
10. answer
float (*abc)(float (*def)(float *ghi));