I know that in computers, value returned by the main()
function is received by the operating system.
But, what happens in the main()
function of a microcontroller?
Electronic – Who receives the value returned by main()
avrcmicrocontroller
Related Topic
- Electronic – AVR- “Bootloader Main function and Application Main function”
- AVR main loop interference with relay
- What value is written onto microcontroller pins if i send the value as character type in Embedded c program
- Use of free() in PIC Microcontroller Programming
- Electronic – What happens before main()
Best Answer
On a microcontroller,
main()
is not really expected to ever exit, and the behavior if it does is not defined — so it's up to whoever wrote the C runtime for the microcontroller. I've seen systems that:main()
, so that if it exits, it simply gets called again.main()
ever exits.main()
. This is called "running off into the weeds".I've never seen one that actually does anything at all with the value returned by
main()
. If this is something you actually care about, then you should take a look at — and possibly modify — the source code for your system's C runtime library.