QP School

Full Version: Function prototypes in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Function prototypes provide the compiler with information about the functions before their actual implementation.

// Function prototype
int add_numbers(int a, int b);

int main() {
    int sum = add_numbers(10, 20);
    printf("Sum: %d\n", sum);
    return 0;
}

// Function definition
int add_numbers(int a, int b) {
    return a + b;
}