美文网首页
35 - Passing Arrays to Functions

35 - Passing Arrays to Functions

作者: 社交帐号直接注册 | 来源:发表于2018-01-02 09:03 被阅读0次
#include <iostream>
using namespace std;
void printArray(int theArray[],int sizeOfArray);
int main()
{
    int bucky[3] = {20,54,675};
    int jessica[6] = {54,24,7,8,9,99};
    printArray(bucky,3);
    cout << endl;
    printArray(jessica,6);
}
void printArray(int theArray[],int sizeOfArray)
{
    for(int x = 0;x<sizeOfArray;x++)
    {
        cout << theArray[x] << endl;
    }
}

相关文章

网友评论

      本文标题:35 - Passing Arrays to Functions

      本文链接:https://www.haomeiwen.com/subject/pwffnxtx.html