In C, a function is an independent block of code that performs a specific task when called, and it may return a value to the calling program. Each function is essentially a small program, with its own variables and statements. A program is divided into smaller parts using functions, making it easier to understand, modify, and control. Another benefit of functions is that they are reusable. For example, the printf() and scanf() functions can be used in every C program.
Up to this point, we’ve written just one function, the main(). In this chapter, you’ll learn how to declare and use your own function within your programs.
A function declaration or function prototype specifies the name of the function, ...