The reason is that s is declared only as a pointer without any storage for characters, and sizeof(s)
is the size of the pointer instead of the size of the storage to which it points. This is a typical
example of the problems you encounter if you use C-strings. By using strings, you won’t run into
these problems: