Need to build an array of Char, but dont know how to pass arrays to function


I am having an issue while building a char array for an “output buffer”.

in the sketch below is an example of what im trying to accomplish.

im not sure how to pass the boolean array: IO_Pins to the function: buildAryW_Char.

maybe someone here could give me a few tips as to what im missing??


#define buffLength 512 //output buffer size

int motion_sensor_pin = 40;  //IO input pin
int Cycle_pin = 42; //IO input pin
int Alarm_pin = 44; //IO input pin
int hAlarm_pin = 46; //IO input pin
int auxInput_pin = 48; //IO input pin

boolean IO_Pins[16]; //an array to store the IO input pin states
char outBuffer[buffLength];  //the main output buffer
int charIdx = 0; // current position of the main buffer, will be reset in "clearAry()"

void clearAry() {  //simply clears the buffer array and resets all associated counters
  for (int x = 0; x <= buffLength; x++) {
    outBuffer[x] = 0;
  charIdx = 0;

void buildAry(String input) { //feeds strings into the main buffer (I would love to Not Use Strings At All Though)
  for (int x = 0; x < input.length(); x++) {
    outBuffer[charIdx] = input[x];
    charIdx += 1;

void buildAryW_Char(char *input,int len) { //here i am trying to append the values from one array to the main buffer array.
  for (int x = 0; x < len; x++) {
    outBuffer[charIdx] = input[x];
    charIdx += 1;

void setup() {

void loop() {
  buildAry("?IO="); //string containing part of an HTTP post header
  IO_Pins[0] = digitalRead(motion_sensor_pin);
  IO_Pins[1] = digitalRead(Cycle_pin); 
  IO_Pins[2] = digitalRead(Alarm_pin);
  IO_Pins[3] = digitalRead(hrAlarm_pin);
  IO_Pins[4] = digitalRead(auxInput_pin);
  buildAryW_Char(IO_Pins, 4); //ERRORS HERE
  for(int x = 0; x <= 4; x++) { //for seeing what is really in the IO_Pins array
  Serial.println(' '); //for new line only
  clearAry(); //done this cycle, clear everything and do it again.

The IO_Pins array is declared as global. Hence you do not need to pass it to the function.