I'm reading the C Programming Language (chapter 5), and I'm confused by this example:
int n, array[SIZE], getint(int *);
Why is this function call in here like that? Is this just some tricky example and invalid code?
I'm reading the C Programming Language (chapter 5), and I'm confused by this example:
int n, array[SIZE], getint(int *);
Why is this function call in here like that? Is this just some tricky example and invalid code?
It's not calling the function; it's declaring its prototype. It's equivalent to:
int n;
int array[SIZE];
int getint(int*);
Since the statement began with a type specifier, namely int, then it suggests declaration. Thus what follows is a bunch of comma separated list of identifiers.
n
being a single int variable.
array
being an array of int.
getint
being a function that returns an int and has one parameter that is an int pointer. It is unnamed and that is not important because this is a function declaration/prototype.