|
|
|
|
||=== Build: Debug in c++homework (compiler: GNU GCC Compiler) ===| main.cpp||In function ‘int main()’:| main.cpp|6|error: too many initializers for ‘int [3]’| main.cpp|6|error: too many initializers for ‘int [3]’| main.cpp|6|error: too many initializers for ‘int [3]’| main.cpp|5|warning: unused variable ‘test3’ [-Wunused-variable]| ||=== Build failed: 3 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===| |
||=== Build: Debug in c++homework (compiler: GNU GCC Compiler) ===| main.cpp||In function ‘int main()’:| main.cpp|12|error: ISO C++ forbids variable length array ‘test’ [-Wvla]| ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===| |
||=== Build: Debug in c++homework (compiler: GNU GCC Compiler) ===| main.cpp||In function ‘int main()’:| main.cpp|12|error: too many initializers for ‘int [3]’| main.cpp|12|error: too many initializers for ‘int [3]’| main.cpp|12|error: too many initializers for ‘int [3]’| ||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===| |
but why i don't get the same error? |
test3
is set at runtime not at compile time, hence the compiler will not be able to tell whether the dimensions are correct.