C语言基础:数组作为函数参数传递演示源码
将做工程过程中常用的内容片段记录起来,如下内容内容是关于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 values70809010090About to display 10 values12345678910About to display 2 values-33-44
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。