int **arr = new int*[n]; for(size_t i = 0; i!=n; ++i) arr = new int[m]; int **arr = new int*[n]; arr[0] = new int[n*m]; for(size_t i = 1; i!=n; ++i) arr = arr[i-1] + m;
Standard input is empty
prog.cpp:1:22: error: 'n' was not declared in this scope int **arr = new int*[n]; ^ prog.cpp:2:1: error: expected unqualified-id before 'for' for(size_t i = 0; i!=n; ++i) ^ prog.cpp:2:19: error: 'i' does not name a type for(size_t i = 0; i!=n; ++i) ^ prog.cpp:2:25: error: expected unqualified-id before '++' token for(size_t i = 0; i!=n; ++i) ^ prog.cpp:5:7: error: redefinition of 'int** arr' int **arr = new int*[n]; ^ prog.cpp:1:7: note: 'int** arr' previously declared here int **arr = new int*[n]; ^ prog.cpp:5:22: error: 'n' was not declared in this scope int **arr = new int*[n]; ^ prog.cpp:6:1: error: 'arr' does not name a type arr[0] = new int[n*m]; ^ prog.cpp:7:1: error: expected unqualified-id before 'for' for(size_t i = 1; i!=n; ++i) ^ prog.cpp:7:19: error: 'i' does not name a type for(size_t i = 1; i!=n; ++i) ^ prog.cpp:7:25: error: expected unqualified-id before '++' token for(size_t i = 1; i!=n; ++i) ^
Standard output is empty