I want to use something like this:
char theArray[]=new char[8];
theArray= { 1,2,3,4,5,6,7,8};
instead of
char theArray[] = { 1,2,3,4,5,6,7,8};
Is a similar thing possible?
C++0x
char* ch;
ch = new char[8]{1, 2, 3, 4, 5, 6, 7, 8};
@David Thornley: then switch these lines and there is no problem. And seriously you're talking about reallocating char[8]
in the same memory pool as the previous value, then you need to play with own allocators, something like:
char* ch1 = new char[8]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'i'};
char* ch2 = new(ch1) char[8]{1, 2, 3, 4, 5, 6, 7, 8};
afaik OP is not likely to need that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With