The following code snippet for calculating strlen
int s(const char* str)
{
int count=0;
while(*str++) count++;
return count;
}
You can see that the str argument is a constant. But the compiler does not complain when I do str ++. My question is:
When passing pointers as arguments to C, if is matches const, how can I do pointer arithmetic on it? What is const in the above function?
source
share