Lesson 10 – Functions
There are two types of functions that we can use in the C language.
- Library functions
- User-defined functions
Library functions can be used by including the respective header file and then calling the function in the main body.
User-defined functions are the ones defined by the users as per their requirements.
Defining these is done in three steps:
- Declaring the function before “main”
For example, message();
Here “message” is the name of the function. Note that we have used statement terminator (;) here.
- Calling the function in the main.
Again here we need to use statement terminator.
- Defining the function after “main”
message(); —> 1
message(); —> 2
message() —> 3
Printf (“Hello functions!!!”);
able on which decision will depend.