题解 | #利用指针遍历数组#
利用指针遍历数组
https://www.nowcoder.com/practice/fd4530358d57455da387df95a19d14c1
#include <iostream> using namespace std; int main() { int arr[6] = { 0 }; int* ptr = arr; int len = sizeof(arr) / sizeof(int); for (int i = 0; i < len; i++) { cin >> arr[i]; } // write your code here...... for(int j = 0; j < len; j++){ printf("%d ", arr[j]); } return 0; }