In C89, this causes an undefined exit status to be returned to the host
environment, but it no more an error than printing the result of rand().
Actually, every time I post this sort of thing (which is my stock sort
of response to idiotic "Why this works?" type posts), I forget about the
need for a "return 0;" at the end (actually testing my code with gcc
with all warnings turned on would have shown this up).
Still, I have to ask this: The C standard of course says that once UB
happens, all bets are off. And, let's assume for the sake of argument
that the above program does cause UB. But the point is, it doesn't
cause the UB until the function returns. I.e., the statement above is
"... once UB happens". But it is not the case that future UB can cause
current operations to fail. So, the above program would (under all the
usual CLC rules) work, as far as printing "hello, world", even though it
might start global thermonuclear war thereafter.
P.S. Of course, I lied in the original post, since if I had compiled it
with all warning turned on, I would have noticed the lack of "return 0;".
Oh well...