Greetings. The code below gives a couple of error messages that have me puzzled.
1 2 3 4
int main()
{
int* ptr = newint[] {0,1,2,3,4};
}
the errors are
||=== Build: Debug in PPP1 (compiler: GNU GCC Compiler) ===|
error: expected primary-expression before ']' token|
error: too many initializers for 'int [1]'|
when I change the code as below the errors go away
1 2 3 4
int main()
{
int* ptr = newint[5] {0,1,2,3,4};
}
what gives. The book I am reading (Stroustrop) says that the number of elements can be left out when an initializer list is supplied.