C语言基础:数组作为函数参数传递演示源码

发布时间:2020-06-22 21:46:24 作者:Ilovejcode
来源:网络 阅读:755

将做工程过程中常用的内容片段记录起来,如下内容内容是关于C语言基础:数组作为函数参数传递演示的内容,应该能对小伙伴也有好处。

#include <stdio.h>

void show_array(int values[], int number_of_elements)
 {
   int i;

   printf("About to display %d valuesn", number_of_elements);
   for (i = 0; i < number_of_elements; i++)
    printf("%dn", values[i]);
 }

int main(void)
 {
   int scores[5] = {70, 80, 90, 100, 90};
   int count[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
   int small[2] = {-33, -44};

   show_array(scores, 5);
   show_array(count, 10);
   show_array(small, 2);

return 1;
 }

输出结果

About to display 5 values
70
80
90
100
90
About to display 10 values
1
2
3
4
5
6
7
8
9
10
About to display 2 values
-33
-44
推荐阅读:
  1. 【基础】固定列宽的表格及示例演示
  2. C语言基础:atexit用法演示源码

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

函数传递 数组

上一篇:C语言实现输入两个数输出最大数的方法

下一篇:管理无定式,规范还需敏捷

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》