C took an unusual approach for its declaration syntax. In C, one can write an expression involving the item being declared, and states what type that expression will have. 1
E.g.,
int *p
is a int pointer because*p
is anint
int a[3]
is an integer array becausea[3]
is anint
For functions, originally C’s function declaration syntax was like the following
int main(argc, argv)
int argc;
char *argv[];
{ /* ... */ }
so int main(argc, argv)
is a function because main(argc, argv)
returns an int
.
For more complicated examples, C’s declaration read like a spiral 2.