In this post, we know about User Defined Functions.
But first, we should know what is a function?
A function is a set or group of statements to achieve a particular output.
A C program always consists of at least one function, i.e. main().
There are two types of functions in C. They are as follows :
1. Library Functions
2. User Defined Functions
These are functions which are predefined to perform certain tasks and are not required to be written by the user.
eg. printf, scanf, strcat etc.
User Defined Functions
These are the funcions to be developed by the user at the time of coding a program.
Did you know?
Your program will not run without a main() function. It will compile successfully but will not run!
Advantages of UDFs :
1. They can be used any number of times in the program.
2. Once error free, it will always give desired result.
3. It is easier to simply call the function than writing the code every time.
4. UDFs make debugging very simple, easy and quick.
5. With UDFs the program code becomes more simpler and readable.
See what are the parts of a function.
We hope that you found this article to be helpful.
Please share your thoughts in the Comments Section.
If you liked this article, then please like our Facebook page.