Code: Select all
#include <iostream>
using namespace std;
int main() {
int a[2][3] = { {1, 2, 3}, {4, 5, 6} };
int *(*b)[3];
for (int i = 0; i < 2; i++)
for (int j = 0; j < 3; j++)
b[i][j] = &a[i][j];
for (int i = 0; i < 2; i++)
for (int j = 0; j < 3; j++)
cout << *b[i][j] << " ";
cout << endl;
return 0;
};
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
0x0040147c in main () at test-p.cpp:8
8 b[i][j] = &a[i][j];