5.10.1 The main Function
The identifier main is special. You must always have one,
and only one, function called main() in your programs. This is the first C
function to execute in your program.
Since your program is not called by a host,
the compiler inserts special code at the end of main(), which is executed
if this function ends, i.e., a return statement inside main() is executed,
or code execution reaches the main()’s terminating right brace. This
special code causes execution to jump to address 0, the Reset vector for all 8-bit PIC devices. This essentially performs a software Reset.
Note that the state of registers after a software Reset can be different from that after a
hardware Reset.
It is recommended that the main() function does not end.
Place all or some of your code in main() within a loop construct (such as
a while(1)) that will never terminate. For example,
int main(void)
{
// your code goes here
// finished that, now just wait for interrupts
while(1)
continue;
}
