In "classic" C language (C89/90) when you call an undeclared function, C assumes that it returns an int
and also attempts to derive the types of its parameters from the types of the actual arguments (no, it doesn't assume that it has no parameters, as someone suggested before).
In your specific example the compiler would look at do_something(dest, src)
call and implicitly derive a declaration for do_something
. The latter would look as follows
int do_something(char *, char *)
However, later in the code you explicitly declare do_something
as
char *do_something(char *, const char *)
As you can see, these declarations are different from each other. This is what the compiler doesn't like.