Explain function and types with example
Function:
A function is a self-contained block of code that performs a particular task.
Once a function has been designed and packed, it can be treated as a black box that takes some data from the main program and returns a value. The inner details of the operation are invisible to the rest of the program. All that the program knows about a function is : What goes in and what comes out.
Every C program can be designed using a collection of these black boxes known as functions.
C functions can be classified into two categories :
Library functions : This functions are built-in functions and not required to be written by user.
example : sqrt, printf, scanf, exp( ).
2. Used-Defined functions : It has to be developed by the user at the time of writing a program. However it can later become a part of the C program library.
example : main( ).