use union for mixing input const char pointer and char pointer for allocated memory