溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

C語言基礎(chǔ):數(shù)組作為函數(shù)參數(shù)傳遞演示源碼

發(fā)布時(shí)間:2020-06-22 21:46:24 來源:網(wǎng)絡(luò) 閱讀:769 作者:Ilovejcode 欄目:編程語言

將做工程過程中常用的內(nèi)容片段記錄起來,如下內(nèi)容內(nèi)容是關(guān)于C語言基礎(chǔ):數(shù)組作為函數(shù)參數(shù)傳遞演示的內(nèi)容,應(yīng)該能對(duì)小伙伴也有好處。

#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;
 }

輸出結(jié)果

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
向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI