I have the following function structure
int function(const char *str)
{
return 0;
}
I never could fully understand why people use char *str
rather than simply string str
. So I am guessing this basically means that the argument is the pointer to the first character of the string. How do I determine the length of the string str
given that argument?
What I've tried is to iterate through str
, if I hit a NULL
or ""
or ''
, then that will be the end of it. However, none of these types are compatible for comparison. Please give me some clue regarding this. Thx!