how to take an array as a parameter in c++ code example
Example 1: array as parameter c++
void myFunction(int param[]) {
.
.
.
}
Example 2: 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;
}