Open bKash and look at how many ways there are to send money. You can tap Send Money on the home screen, pick a name from your recent contacts, or scan a shop's QR code. Three different doors, but behind all three the same job happens: take an amount from one account, add it to another, and say whether it worked. The people who built the app did not write that job three times. They wrote it once, gave it a name, and every door simply calls that name. If they ever find a bug in it, they fix it in one place and all three doors are fixed at once.
That named, reusable piece of work is a function, and it's what this chapter is about. In the three lessons of Programming Fundamentals, every program you wrote lived inside a single main: variables, decisions and loops, all in one long block. That's fine for twenty lines. A real program is built from many small functions, each doing one job well, and main mostly calls them in the right order.
By the end of this chapter you'll be able to write a function in C and say what each part of it is called, in the words examiners use: prototype, definition, call, parameter, argument, return value. You'll know what return can and can't send back, how it differs from exit, and why nobody can tell you which of two calls in one expression runs first. You'll explain call by value, call by address and C++'s call by reference, and write the swap program that written papers ask for again and again. You'll see what really travels when you pass an array, how one function can hand back two results, and how a pointer can hold a function. And you'll use C++'s default arguments, overloading and inline functions without falling into their traps.