Usage

Include the header file to use the arrayhelpers library.

#include <arrayhelpers.h>

Examples

Array size

#include <arrayHelpers.h>


void setup() {
  Serial.begin(9600);

  int a[] {1, 2, 3, 4, 5};
  Serial.println(arraySize(a));  // Prints "5".
}

void loop() {}

Passing an array to a function

#include <arrayHelpers.h>


void printArray(Span<int> s) {
  for (int const& i: s) {
    Serial.println(i);
  }
}


void setup() {
  Serial.begin(9600);

  int a[] {1, 2, 3, 4, 5};
  printArray(a);
}

void loop() {}