我在这一行遇到了段错误:
cout << b[0][0];
有人能告诉我如何修复我的代码吗?
#include <iostream>
using namespace std;
int** gettab(int tab[][2]){
return (int**)tab;
}
int main() {
int a[4][2] = {{0, 0}, {1, 0}, {2, 0}, {2, 1}};
int ** b = gettab(a);
cout << b[0][0];
return 0;
}
int(*)[2]
的 typedef 也可以使用。) - Roger Pate