move char* declaration at the beginning of the function