Page 1
Wink Notes
B.Tech CSE — 1st Semester
Programming for Problem Solving in C
— Unit - 3 —
1. Why Functions?
Imagine writing a 10,000-line C program inside a single `main()` function. It would be impossible to read, debug, or reuse code. A function is a self-contained block of code that performs a specific task. It takes inputs (parameters), does some work, and gives an output (return value).
Modularity
Break a massive problem into tiny, solvable pieces.
Reusability
Write the logic for `calculateTax()` once, and call it 500 times from different places.
Abstraction
You can use `printf()` without needing to know exactly how it talks to the computer monitor.