I have some code that creates a function right before my set up code. And my question is will this function execute if I don't call it during my setup or loop function? I don't want it to execute at the beginning of my code but I need to define it somewhere.
So are you guys saying the custom function would be executed or just defined when I place it at the top? I am hoping to call it in the void loop section with customfunction() but just define it at the top of the code.
If your function() is never referenced in the ‘active’ code, there’s a high likelihood the compiler/linker will optimise it into obloivion. - unless you tag it to force persistence.
I think you are confused because you see loop and setup defined and magically execute so you think defining another function is going to magically execute it too. loop and setup both are called from the code you don’t see from ‘int main’, the entry point if the c++ program. so no, unless you explicitly call your function, it won’t run, or even exist in compiled code.