C++ 利用using语句:
其一:指定别名
点击查看代码
int p[4][4] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
for (int(*i)[4] = p; i != p + 4; i++) {
for (int* j = *i; j != *i + 4; j++) {
cout << *j << endl;
}
}
利用using之后
点击查看代码
<summary>点击查看代码</summary>
using int_array = int[4];
int main() {
int p[4][4] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
for (int_array(i) = p; i != p + 4; i++) {
for (int j = *i; j != *i + 4; j++) {
cout << *j << endl;
}
}
}
但是不能这样
</details>
using int_array = int[4];
int main() {
int int_array[4] = {0,0,0,0};
}