allocating memory for char array in free store

Why I'm unable to create this array the 2nd way? How could it be done without at 1st creating this array (char arr[] = "Hello";) and only than creating pointer to it?
I'm getting this error message from compiler
Error 1 error C2440: 'initializing' : cannot convert from 'initializer-list' to 'char []'


1
2
3
4
int main(){
    char* p1 = new char[] {'H', 'e', 'l', 'l', 'o', '\0'};   // works
    char* p2 = new char[] {"Hello"};   //this gives error
}
Topic archived. No new replies allowed.