passing arrays to functions

I would like to define an array so that I could pass that array (of 5 numbers in this instance) to a function that I have defined. For example, I would make the following definition:

int one[5]={2,3,4,5,6}; // 5-number array to pass along

Then inside my loop I would pass this to the function 'myLED()' which I hdefine later:

void loop() {
myLED(one); // pass along the 5 numbers to the function 'myLED()'
}

I would define the function 'myLED()' below:

void myLED(int i,int j,int k, int l,int m) {
pinMode(i,OUTPUT); digitalWrite(i,HIGH);
// and the rest of the function definition using the 5 integers i,j,k,l,m
}

Error messages include things such as
'error: too few arguments to function 'void myLED(int, int, int, int, int)'
and,
' void myLED(int i,int j,int k, int l,int m) {

^

exit status 1
invalid conversion from 'int' to 'int*' [-fpermissive]'

I have tried int and int* and various permutations of the array declaration (e.g. #define ...) but I can't get the syntax right to pass the 5 numbers as a named variable. Any thoughts?

Try a google search on how to pass arrays in C.

First result I got: Pass arrays to a function in C explains all you should need to know.

All your function needs to know is the array name and the size of data it points to. You can use indexes or pointers to get to the data...they are essentially the same. Take some time to study this short program:

#define ELEMENTS(x)   (sizeof(x) / sizeof(x[0]))

int one[]={2,3,4,5,6};     // Let the computer count how many elements you need

void setup() {
  Serial.begin(9600);
  myLED(one);              // pass along the 5 numbers to the function 'myLED()'
  yourLED(one);
}



void myLED(int myArray[]) { 
  int i;

  Serial.println("In myLed:");

  for (i = 0; i < ELEMENTS(one); i++) {
    Serial.print(myArray[i]);             // Array indexing
    Serial.print("  ");
  }
  Serial.println();
}

void yourLED(int myArray[]) {
  int i;

  Serial.println("In yourLed:");
 
  for (i = 0; i < ELEMENTS(one); i++) {
    Serial.print(*myArray++);             // pointers
    Serial.print("  ");
  }
  Serial.println();
}
void loop() {
}

Thank you countrypaul and econjack! That worked nicely. My mistake was not 'receiving' the array in the definition of myLED().