A function is a self-contained block of code that performs a specific task. A function will be executed only when it is called by the program and it can be called any number of times. It helps you organize your program and lets you reuse a block of code anywhere in the program.
Every C program contains at least one function which is
main(). The C Standard Library provides many functions that can be readily used in your program. These functions are called the Standard C Functions.code> printf(), scanf(), getchar() are examples of Standard C Functions. You can write your own functions in a program and these are referred to as User Defined Functions.
To write your own functions you need to first declare it, then define what it does and call it from your program. A function has a name and can accept a number of arguments. Arguments are used to pass data to a function. Functions can also return some value back to its caller.