0

We know int main() returns 0 to OS when it terminates without error and non-zero in case of failure. But how will the OS identify normal(without error) or abnormal(error) termination in case of void main().

David Ranieri
  • 36,077
  • 6
  • 44
  • 85
  • 4
    Such a program is a non-conforming C program. Anything can happen if a compiler accepts such a `main` function. – R Sahu Aug 30 '16 at 05:20
  • 1
    It won't. And therefore it is better to stick to that convention if you implement OS related functionalities. – Ely Aug 30 '16 at 05:21
  • 2
    @RSahu however it is implementation-defined if the compiler accepts `void main`, so such a compiler would have documented behaviour – M.M Aug 30 '16 at 06:58
  • @RSahu See [this answer](http://stackoverflow.com/a/9356660/1791872) – flau Aug 30 '16 at 08:21

0 Answers0