I am so sorry! That is my mistake. I disunderstood the meaning of ++ operator when I wrote above. *(ptr++)=0 and *ptr++=0 get the same result. It should be *++ptr=0. Sorry again!
An interesting question.