I'm reading the solution to a problem in the book Cracking the Coding interview (Q 1.2). The objective there is to implement a function void revers(char* str) in C that reverses a null terminating string.
The solution code looks something like this:
void reverse(char *str)
{
char* end=str;
char tmp;
if(str)
{
while(*end)
{
end++;
}
end--;
//code to reverse
}
}
Here, str contains an address right? And if(str) will only evaluate to false if str is 0, right?
So what I'm saying is, is there no chance that str will contain the address 0x0000, thus evaluating if(str) to false?