Answers for "how to pass an array to a function c++ by reference"

C++
4

passing array to function c++ pointer

void generateArray(int *a, int si)
{
    for (int j = 0; j < si; j++)
        a[j] = rand() % 9;
}

int main()
{
    const int size=5;
    int a[size];

    generateArray(a, size);

    return 0;
}
Posted by: Guest on June-23-2020

Code answers related to "how to pass an array to a function c++ by reference"

Browse Popular Code Answers by Language