(char*)NULL doesn't turn NULL into a string like "NULL" if that's what you thought. NULL is actually a macro which expands to 0. Casting it to char* turns it into a pointer to zero (a null pointer). The only problem comes with printing it out. It is Undefined Behavior to try to print a null-pointer. Up to this point you cannot make sense of any behavior your program exhibits. The fact that your program didn't crash is a surprise to me.