-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprint.cpp
More file actions
34 lines (26 loc) · 807 Bytes
/
print.cpp
File metadata and controls
34 lines (26 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
using namespace std;
#define array_number 64
int matrix[array_number][array_number];
int **double_array(size_t n) {
int **result = new int*[8];
for (int i = 0; i < n; ++i) {
result[i] = matrix[i];
for (int j = 0; j < n; ++j){
result[i][j] = j;
}
}
return result;
}
int main() {
// cout<<"A magic print! If you comment this, the program will break."<<endl;
int **result = double_array(array_number);
for (int i = 0; i < array_number; ++i) {
cout<<"print address of result["<<i<<"] "<<&result[i][0]<<endl;
for (int j = 0; j < array_number; j++) {
result[i][j] = j;
cout<<"print content of result["<<i<<"]["<<j<<"] "<<result[i][j]<<endl;
}
}
free(result);
}