I wrote a function foo() that takes 2 const char* as arguments, pBegin and pEnd . foo() null-terminated string is passed. By default, pEnd points to the \0 (last character) string.
void foo (const char *pBegin, const char *pEnd = strchr(pBegin, 0))
However, I get an error message in the line above:
error: local variable 'pBegin' may not appear in this context
Why does the compiler not allow such an operation? What is the potential problem?
source share