Chapter 7. Functions
All the instructions of a C program are contained in
functions . Each function performs a certain task. A special
function name is main(): the function
with this name is the first one to run when the program starts. All
other functions are subroutines of the main() function (or otherwise dependent
procedures, such as call-back functions), and can have any names you
wish.
Every function is defined exactly once. A program can declare and call a function as many times as necessary.
Function Definitions
The definition of a function consists of a function head (or the declarator), and a function block . The function head specifies the name of the function, the type of its return value, and the types and names of its parameters, if any. The statements in the function block specify what the function does. The general form of a function definition is as follows:

In the function head, name is the
function’s name, while type consists of at
least one type specifier, which defines the type of the function’s
return value. The return type may be void or any object type, except array types.
Furthermore, type may include the function
specifier inline, and/or one of the
storage class specifiers extern and
static.
A function cannot return a function or an array. However, you can define a function that returns a pointer to a function or a pointer to an array.
The parameter declarations ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access