c++ - 'new char[]' does not work, but it should -


i had code, returned char* if write in cpp:

char* test_char = new char[size]; 

all good, if write in header:

char* test_char; 

and in cpp:

test_char = new char[size]; 

the program compiles not run.

what doing wrong?

char = new char[size];

you want

test_char = new char[size]; 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -