C Compiler Logo

Function Return Type Mismatc

Function Return Type Mismatch

semantic

warning: return makes integer from pointer without a cast

Description

Returning a value that doesn't match the function's declared return type.

Common Causes

Example of Error

Error Code

int getGreeting() {
    return "Hello, World!";
}

Solution

Change the return value to match the function's return type, or change the function's return type.

Corrected Code

char* getGreeting() {
    return "Hello, World!";
}

Additional Tips