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};
}