declared char p on the stack instead of allocating heap ptr