Following is the program I encountered

```
#include <stdio.h>       

void sp_to_dash(const char *str);
int main(void)
{
    sp_to_dash("this is a test");
    return 0;
}
void sp_to_dash(const char *str)
{
    while(*str) //beginning of while loop
    {               
        if(*str== ' ')printf("%c", '-');
        else printf("%c", *str);
        str++;
    }
}

```

At the beginning of `while` loop we can see that `while(*str)` is initiated without any condition, which means it is not mentioned that when the `*str` should stop on `null` or `'\0'`. The code is working fine, however according to me it should be like this `while(*str != null)` or `while(*str != '\0')`. Please explain this one to me.