#include <stdio.h>
//造一个f()函数将数组内容输出
void f(int * pArr,int len) {//知道数组的首地址以及数组的长度即数组元素的个数,即可知道一个数组全貌
for (int i = 0; i < len; i++) {
// printf("%d ",*(pArr+i));//*(pArr+i)等价于pArr[i],等价于b[i]
printf("%d ",pArr[i]);
}
}
int main(void) {
int b[6] = {3,-1,-4,0,5};
f(b,6);
return 0;
}
输出结果:
3 -1 -4 0 5 0
--------------------------------
Process exited after 0.01888 seconds with return value 0
请按任意键继续. . .