题解 | #利用指针遍历数组#
利用指针遍历数组
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...... int *p=arr; for(int i=0;i<6;i++) printf("%d ",*(p+i)); return 0; }