You never assign anything to *cstring. It is an uninitialized pointer. You need to allocate space that *cstring can then point to, either by defining it as a character array instead, or using dynamic memory management (malloc/free). That it is working on any system is a fluke.