Quote:
Originally Posted by bsudhir6 View Post
Sir i want to know when the return types to main functions are must be changed
Never. main always returns int, and you should return either the constant EXIT_SUCCESS, or the value 0, unless you have a good reason for doing otherwise (for example if you want to return an error code to a calling script).

There are exceptions for some compilers, for example the MikroElektronika compilers typically take void for main, but that's because there's nothing to return to: when main returns, the PIC chip has nothing else to do but halt. Maybe OS writers get to use void main too, for the same reason.

Valid main prototypes unless you have a good *technical* reason to use otherwise, are therefore:

int main()
int main(int argc)
int main(int argc, char **argv)
int main(int argc, char **argv, char **envp)

and you should always use one of these four.