The function block is where the work of the function happens.
Within the function block are one or more statements. In our Hello, world! main function, there are only two statements. In the following program, main.c, there is only one—the return 0; statement:
int main() {
return 0;
}
While there is no ideal size, large or small, for the number of statements in a function block, typically, functions that are no longer than either the number of lines in a terminal, 25 lines, or a printed page, say 60 lines, are preferable to much longer functions. TheGoldilocks target—given multiple options, the one Goldilocks in the fairy taleGoldilocks and the Three Bearswould have chosen—in this case, would be somewhere between 25 and 50 lines. Shorter functions are most often preferred over much longer ones.
In some cases, however, longer functions are warranted. Rarely, if ever, are they considered good programming...