-2

In int main(), return value should indicate how the program exited. Generally, We represented by a 0 return value for normal termination and 1 for abnormal termination.

Then, I'm just curious to know, If void main() function not return any return value, then How to operating System know that program normal terminate or not in C?

1 Answers1

1

void main() is not allowed by C standard. main should either return int or some implementation defined data type.

haccks
  • 97,141
  • 23
  • 153
  • 244
  • 1
    It's not *deprecated*; it was never a standard signature to begin with. `main` was always intended to return `int`. – John Bode Feb 20 '17 at 16:55
  • @JohnBode; Yeah. But it was in K&R and I may recalled it from there. – haccks Feb 20 '17 at 17:00
  • 2
    Yeah, unfortunately there are too many references, even reputable ones, that used `void main()`. 27 years since the first ISO standard, and we're *still* fighting this battle. – John Bode Feb 20 '17 at 22:07