arduino get size of array
#include <Arduino.h>
template <typename T, size_t N>
constexpr size_t arraySize(const T (&)[N]) {
return N;
}
void setup() {
Serial.begin(9600);
int myArray[] = {1, 2, 3, 4, 5};
size_t arraySize = arraySize(myArray);
Serial.print("Size of myArray: ");
Serial.println(arraySize);
}
void loop() {
// Your code here
}