A function is a self-contained block that carries out a specific well defined task.
Advantages of functions in C language include −
It is a problem solving method in which a complex problem is solved by splitting into sub problems.
Structure chart is a documentation tool that shows the relationships among the sub problems of a problem.
The splitting of a problem into its related sub problems is the process of refining an algorithm. For example, performing arithmetic operations on 2 numbers, we can do the following −
Refined algorithm for first step is as follows −