A function is a named C program unit that performs a defined operation when called and may return a value. For example, main is defined with a body, while printf is called to produce output: <code>int main(void) { printf("..."); return 0; }</code>. section 2.1 section 2.5
Functions support C programs by:
- Avoiding repeated code, copy-and-paste errors, and duplicated edits. section 7.0
- Improving readability, maintainability, compilation time, and future reuse. section 7.0
- Providing interfaces whose arguments and return types describe data flowing into and out of a computation. section 7.0
- Delegating tasks through calls and transferring control back with returns. section 2.5
Calling and defining functions
A declaration or prototype determines how a function can be called. A definition supplies the function body. main provides the program’s entry point, and library functions such as printf and strlen provide reusable features without requiring their implementation to be repeated. section 2.1 section 7.0 section 7.4
Recursive calls
Each function call has its own copy of local variables, so a function can call itself recursively. Fibonacci examples contrast recursive, cached, and iterative forms and invite runtime measurements. section 7.4



















