econjack:
Also, I still don't know why is works with the function in the *.ino file, but not in the *.cpp file.
cpp file, not the header?
EDIT
this works?
#include "test.h"
uint8_t pinSet[] {
1,2,3,4,5,6,7,8,9,0,11
};
const char *contestExchanges[] = { // Exchange Message for Contest or common info:
" ", // Spaces to create 1-based array and used for erasing messages
"CQ CQ CQ DE W8TEE", // General CQ. Change as needed
"599 OH", // DX CW contest exchange
"1D OH", // Field Day See: http://www.arrl.org/files/file/Field-Day/2016/2016%20Rules.pdf
" A W8TEE 54 OH", // SSCW This message is preceeded by an incrementing QSO number:http://www.arrl.org/sweepstakes
"SKN", // Straight Key Night. Send this before RST report"
"CINCINNATI,OH", // QTH
"NAME JACK JACK",
"RIG HB 5W QRP",
"ANT DIPOLE 25 FT", // NOTE: Last entry has no comma at the end. The compiler automatically allocates emough memory
"Woodland Mounds St Pk"
};
size_t arraySize = NUM_ELEMENTS(sizeof(pinSet), sizeof(pinSet[0]));
size_t heliBob = NUM_ELEMENTS(sizeof(contestExchanges), sizeof(contestExchanges[0]));
void setup() {
Serial.begin(112500);
Serial.println(arraySize);
Serial.println(heliBob); // prints 11?
}
void loop() {
}
#ifndef TEST_H
#define TEST_H
constexpr size_t NUM_ELEMENTS(size_t i, size_t k) {
return i/k;
}
#endif