Reading your blog post, I had to leave a comment and try to help you there. There is no such thing as stack or heap in C. Instead, there is 4 storage duration: automatic, allocated, static and thread. This code has undefined behavior and is bound to fail on most platforms in most scenarios. You should not be surprised.
Another detail, the fact you have a 3-star pointer line #3 tells me you have a biased understanding of pointers.