Easy C++ question
Posted on 2007-11-20
If you have a function that takes a char* as one of its arguments, and then call that function passing in a string, will it be null terminated? If not, how do you get the length of the string?
For example, if your function looks like this:
void Foo(char *bar)
...and you called it like this:
Foo("Hello, World") //Note the lack of an explicit null terminator
Would strlen() in the Foo function get an accurate count since it requires a null terminator? If not, how would I be able to get the count?