← C Programming learning path
C Programming · Module 5 of 10

Functions

Split programs into functions with parameters, return values and prototypes.

📖 Key ideas

  1. A function has a return type, name and parameters: int add(int a, int b).
  2. Declare a prototype before main if the function is defined later.
  3. C passes arguments by value: the function gets copies.
  4. void means the function returns nothing.
  5. Recursion: a function that calls itself with a base case.
💡 Real-life example: A function is a kitchen helper: give ingredients (arguments), get back a dish (return value).
PrototypeFunction declaration before use
voidReturns nothing
Pass by valueFunction receives copies of arguments
RecursionFunction calling itself