In the first example, the loop runs until the pointer itself becomes null, which it never does (instead, it’s eventually incremented past the end of the buffer, whereupon the program exhibits undefined behavior).
In the second example, the loop runs until the character pointed to becomes zero – which it does once the advancing pointer reaches the end of a nul-terminated string.
3
solved What is different between while(aPointer) and a if(aPointer) in C++? [closed]