Reputation: 4873
This is in my teachers code, and it works for me using the GNU compiler, and for my teacher who is on a Mac, but for other classmates using Visual Studio, it throws a lot of errors. I'm thinking that with dynamic memory, you can't initialize something like this, or rather the C++ standard doesn't say you have to be able to. Am I correct in that?
store = new char*[rows];
store[0] = new char[6]{'1', '1', '1', '1', '1', '1'};
store[1] = new char[6]{'1', 'e', '1', '0', '0', '1'};
store[2] = new char[6]{'1', '0', '0', '0', '1', '1'};
store[3] = new char[6]{'1', '0', '0', 'm', '1', '1'};
store[4] = new char[6]{'1', '1', '1', '1', '1', '1'};
Upvotes: 1
Views: 54
Reputation: 310980
It is a valid list initialization. However for example MS VC++ 2010 does not support it, Not all compilers support all features of the C++ 2011.
Upvotes: 1