New answers tagged


If your library is implemented in a single .cpp file, you can define these variables and functions within that file, and give them the static qualifier: static int my_private_variable = 42; static void my_private_function() { ... } Obviously, there should be no mention of them in the .h file. Note also that we are talking about global variables. ...


You can't. You are passing a pointer to the array, and sizeof will give you the size of that pointer (2 on an 8-bit Arduino). Instead the normal way is to pass the size of the array as a parameter to your function. myFunction(myArray, sizeof(myArray) / sizeof(myArray[0]));

Top 50 recent answers are included