C- Are there any other statements that serve the function of returning control to OS?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AmberJain
    Recognized Expert Contributor
    • Jan 2008
    • 922

    C- Are there any other statements that serve the function of returning control to OS?

    HELLO,

    One C programming book says:
    In ANSI C, it is customary, although not required, to include a statement in main() which explicitly returns control to Operating System
    I can think of only two statements that can serve the function of returning control to Operating System i.e.

    return 0;

    exit(0);

    Now my question is that-"Are there any other statements than I mentioned above that serve the function of returning control to OS?"

    THANKS in advance......
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    There's also the Standard abort() function ...

    kind regards,

    Jos

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      The only valid returns from main(), exit(), etc are 0 and 1. All others are indeterminate. What the operating system does with this is also indeterminate.

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        Throw any sort of exception (out of bounds memory access for instance) that causes your program to crash.

        Of course the exact state of you entire computer system will be indeterminate on many platforms after this.

        Comment

        Working...