In C, a function is a self-contained block of code that performs a specific task. Functions are used to break down a program into smaller, reusable sections, making the code more organized and modular. The function is defined by its name, return type, parameters, and body.
Functions in C can be categorized into two types:
- Standard Library Functions: These are built-in functions provided by C, like 
printf(),scanf(), andstrlen(), which perform common operations. - User-defined Functions: These are functions created by the programmer to perform specific tasks. The syntax is:
 
return_type function_name(parameters) {
// function body
}
Functions can also be categorized based on whether they return a value:
- Void Functions: These functions do not return a value. Example: