What is function? Advantage of function.
A function is a self contained block of statement that performs. Some specific and well defined task. A function can be user define or pre-defined function. User defined function is declared, defined and used by the programmer according to their need. Library function is a predefined function in a header file programmer can use this function by simple including header file in the program.
Advantages of function are:
- Function increase responsibility of program code.
- Program development is faster.
- Program debugging is faster and easier.
- Length of the program can be reduced.
- With function, it is easier to understanding the logic involve in the program.
- Function reduces program complexity.
- Recursive call is possible through function.
- Function increases program readability.
What is recursive function?
A recursive function is a function that called itself. To be a recursive function.
- It should call itself
- It should have a stopping condition
- Every time the function is called, it should be closer to the stopping condition
Please follow and like us: