Nearby lessons

79 of 124

C - Return Statement

Return Statement is one of the foundational topics in C programming. This lesson explains Return Statement with complete, runnable code examples, clear step-by-step explanations, and common mistakes to avoid with exam-style MCQs at the end.

Return Statement

The return statement does two things: it gives a value back, and it immediately ends the function.

Example01
CCode Cell
1return value; // send a value back and end the function
2return; // just end the function (for void)
📝 Key Takeaways
  • Functions split code into reusable, readable tasks.
  • Three parts: declaration, definition, call.
  • Four combinations of arguments and return values.
  • C uses call by value — functions get a copy, originals stay unchanged.
  • return gives a value back and ends the function.
  • Recursion = a function calling itself, with a base case to stop.
  • Classic recursion: factorial and Fibonacci.

🧠 Test Your Knowledge

1 Questions
Progress: 0 / 1