This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

main( ) function

I want to know something regarding main function. For an application, the syntax for main function is something like:
void main(void)
{
// ...
// code
// ...
}
but if we write as:

int main(void)
{
// ...
// code
// ...
return(0);
}

Here, who will handle the return value from main function. Normally embedded application is an infinite loop, so there wont be any chance of returning from main. But still it it terminates, then who will there to handle return value from main.

Parents
  • These parameters and return value are just a kludge left over from C's origin in Unix
    Drew, while what you state is correct, I do not see the parametres for main() to be a kludge for non-embedded systems.

    A "run several things at the same time" computer (windows, linus, OS-X, Unix) may very well have the need for these things. Remeber, even DOS had return values.

    Erik

Reply
  • These parameters and return value are just a kludge left over from C's origin in Unix
    Drew, while what you state is correct, I do not see the parametres for main() to be a kludge for non-embedded systems.

    A "run several things at the same time" computer (windows, linus, OS-X, Unix) may very well have the need for these things. Remeber, even DOS had return values.

    Erik

Children
No data