Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The C standard requires main to be defined as a function, but failure to do so is not a constraint violation, so no diagnostic is required. If you define it as something else, the behavior is undefined.

A conforming C compiler could reject a program that defines main as an array, but is not required to do so.

gcc doesn't complain by default, but with warning enabled it says "warning: 'main' is usually a function".



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: