What is a Function?
A function is a block of code that performs a specific task. It allows code to be reused, organized, and easier to debug.
Example: printf(), scanf(), and main() are all functions.
Benefits of Using Functions:
- Improves code readability
- Promotes reusability
- Helps in modular programming
- Makes debugging easier
Types of Functions in C:
|
Type |
Description |
|
Library Functions |
Built-in functions like printf(), strlen() |
|
User-defined Functions |
Functions created by the programmer |