C Compiler Logo

Implicit Function Declaration

Implicit Function Declaration

warning
warning: implicit declaration of function 'customFunction'

Description

The program calls a function without declaring it first, which can lead to unexpected behavior.

Common Causes

Example of Error

Error Code

int main() {
    customFunction();  // No declaration for customFunction
    return 0;
}

Solution

Declare functions before calling them or include the appropriate header file.

Corrected Code

// Declare the function
void customFunction();

int main() {
    customFunction();
    return 0;
}

// Define the function
void customFunction() {
    printf("Custom function called\n");
}

Additional Tips