История изменений
Исправление comp00, (текущая версия) :
1 #include<iostream>
2 #define SIZE 4
3 int main(int argc, char **argv){
4 int **array = new int*[SIZE];
5 for(int i=0;i<SIZE;++i){
6 array[i]=new int[SIZE];
7 }
8
9 for(int i=0; i<SIZE;++i){
10 for(int j=0;j<SIZE;++j){
11 std::cout<<" "<<&array[i][j];
12 }
13 std::cout<<"\n";
14 }
15 for(int i=0;i<SIZE;++i){
16 delete array[i];
17 }
18 delete [] array;
19 return 0;
20 }
Результaт:
./tst
0x1989040 0x1989044 0x1989048 0x198904c
0x1989060 0x1989064 0x1989068 0x198906c
0x1989080 0x1989084 0x1989088 0x198908c
0x19890a0 0x19890a4 0x19890a8 0x19890ac
Исходная версия comp00, :
1 #include<iostream>
2 #define SIZE 4
3 int main(int argc, char **argv){
4 int **array = new int*[SIZE];
5 for(int i=0;i<SIZE;++i){
6 array[i]=new int[SIZE];
7 }
8
9 for(int i=0; i<SIZE;++i){
10 for(int j=0;j<SIZE;++j){
11 std::cout<<" "<<&array[i][j];
12 }
13 std::cout<<"\n";
14 }
15 for(int i=0;i<SIZE;++i){
16 delete array[i];
17 }
18 delete [] array;
19 return 0;
20 }
Результaт:
./tst
0x1989040 0x1989044 0x1989048 0x198904c
0x1989060 0x1989064 0x1989068 0x198906c
0x1989080 0x1989084 0x1989088 0x198908c
0x19890a0 0x19890a4 0x19890a8 0x19890ac