Functions In C
- Sets of statements known as functions accept inputs, carry out specific processes, and return outcomes.
- Only when a function is invoked does it begin to function.
- We can call the function rather than continually writing the same code for various inputs.
Syntax:
void function_name(void)
{
// function body
}
Types Of Functions:
|
User-Defined Function:
- These are the functions that are created by the programmer to perform specific tasks.
- The programmer can define the function according to their requirements and use it in their program.
- You can also create functions as per your need and user can use it many times. Such functions created by the user are known as user-defined functions.
Library Function:
- Using library functions in the program can save time and effort these functions are already implemented and tested.
- It is important to understand the functionality and limitations of these functions to use them effectively in the program.
- Library function are the functions which are declared in the C header files such as scanf(), printf(), gets(), floor() etc.
More topic in C