CHAPTER 17 / 26

C Return Values

Learn how functions return results to the calling code.

01 — Syntax

return value;

02 — Example

#include <stdio.h>

int add(int a, int b) {
    return a + b;
}

int main() {
    printf("Result = %d", add(10, 20));
    return 0;
}

03 — Important Points

04 — Common Mistakes

05 — Real-World Use

Return values let functions communicate results to other parts of a program.

06 — Practice

Create a small program that demonstrates the main idea of C Return Values.

▶ Try It Yourself← PreviousNext →All Chapters