Why is the endless loop in the main function is :
for (;;)
{
if (exit_code != 0)
break;
}
return exit_code;
and What causes exit_code = -1?
Hi @QJ_HAPPY
The code that you get from the main function is just a template. That you can use or not.
Normally, you want the software of an embedded system to execute constantly and so, an infinite loop can help you there.
Returning different values that 0 like, return 1 or return -1 can mean that function finished returning error. But this is not mandatory and it's just a way to evaluate the execution of a function. Anyway you can give it the meaning you need.
Best Regards and Happy Coding!