第三次作业

1.码云Git账户:695215455@qq.com

2.

3.

#include <stdio.h>
void fun(int a[])
{
    int i;//定义一个变量i 
    for(i=0;i<=9;i++)//利用一个for循环 完成对数组的遍历 
    printf("%d\n",a[i]);//输出数组    
 } 
 int main()
 {
     int a[]={0,1,2,3,4,5,6,7,8,9};//定义一个数组 
     int *p;//定义一个指针 
     p=a;//指针P指向数组a 
     fun(a);//调用函数fun,传递指针的地址 
 }

运行结果:

0
1
2
3
4
5
6
7
8
9

--------------------------------
Process exited after 3.602 seconds with return value 0
请按任意键继续. . .

总结:

通过定义fun函数来传递数组。过程中没有出错,以后还需要多做题,多实践。

 

posted @ 2017-03-31 19:52  voyageur  阅读(113)  评论(0编辑  收藏  举报