Bartholomew Simpson wrote:
To set a default string in a function prototype (signature), which of
these is correct?
void foo( char* dflt= "boo"); //OR
void foo( const char* dflt= "boo");
Standard C (C99) does not support default arguments. Some compilers
(like lcc-win32) do support that feature. For those compilers, and for
C++ the crucial difference of both declarations is whether the
function modifies or not its argument.
If it does, and you pass it a pointer to a constant string like "boo"
the function will modify a constant string, a very bad idea.
The best is then that the function doesn't modify its arguments.
In that case const is better.
jacob