Advertisement

C Functions & Recursion

Previous Lesson 127 of 128 Next
Advertisement
Lesson Overview: Declare prototypes, pass arguments by value or pointer, and write recursive functions.

Pass by Value vs Pointer

C passes arguments by value (copy). To swap or update caller data, pass pointers (int *a, int *b).

  • Declare function prototypes above main()
  • Recursion always needs a base return case

Recursive Factorial in C (Editable — type & Run)

Advertisement

Test Yourself With Exercises

Return 0 from main() to signal successful program termination:

0;
Advertisement