The reason for the warning is forgetting to include string.h
What the warning means in detail, is that in older C from the 90s, it was valid to use a function without declaring it. So if you didn't provide the relevant header like string.h where the declaration is found, the compiler would then "guess" what function format you want and try to silently declare the function "between the lines".
The compiler would have implicitly given you this:
int strlen (); // accepts any parameters
But the real and correct strlen
declaration is this:
size_t strlen (const char *s);
These aren't compatible types, hence the warning about incompatible declaration. The actual definition of the strlen
function matches the latter, but not the former, so this is a bug.
From the year 1999 and beyond, implicit function declarations were removed from the C language, since they were plain dangerous. The gcc compiler still allows obsolete style C though, if you configure it a certain way.
If you are a beginner, you should always compile with a strict and standard compliant setup:
gcc -std=c11 -pedantic-errors -Wall -Wextra
This will swap the mentioned warning for an error, which is nice since this was a program-breaking bug.