#pass array to function

8 messages · Page 1 of 1 (latest)

vale vessel
#

Using namespace std;

void myArray( int x[5] )

{

for (i = 0; i < 5; i++)

{

cout << x[i] << " "

}

}

int main() {

int myArray[5] = {1, 2, 3, 4, 5};

printArray(myArray);

return 0;

}

primal mesaBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

primal mesaBOT
#

Using namespace std;

Void myArray( ```cpp
int x[5] )

{
for (i = 0; i < 5; i++)

{
cout << x[i] << " "
}
}

int main() {
int myArray[5] = {1, 2, 3, 4, 5};

printArray(myArray);

return 0;
}

Oppenheimer
primal mesaBOT
#

Using namespace std;

void myArray(int x[5])

{
  for (i = 0; i < 5; i++)

  {
    cout << x[i] << " "
  }
}

int main() {
  int myArray[5] = {1, 2, 3, 4, 5};

  printArray(myArray);

  return 0;
}
Oppenheimer
vale vessel
#

!solved