It is not incorrect to use void main
Cars that use rubber tires arn't no good (or incorrect to use) just because the rubber tire might burst or catch a hole in it once every five or so years.
In the same way, it is not 'incorrect' to use void main as salem suggests. I agree to salem - it is not recommended - but i don't agree to expression 'incorrect'.
If it was 'incorrect' than it wouldn't work. And since it isn't incorrect hence the reason why almost evey compiler in the world accept the statement void main without flashing any errors or warnings - although i don't reccomend using it anymore - and hence the reason why the ANSI C standard doesn't say/recommend something like "void main is not recommended".
I've used the expression in many programs and no errors have ever occured - when they do i will tell you.
An operating system doesn't get confused because it does not think. If it does get confused than it's because it has a logical error in it - which would be very rare these days considering how many times most major operating systems were logically tesed, dry runned, and upgraded. These days the OS is very well prepared for these types of occurences with it's plentiful use of error messages.
Re: It is not incorrect to use void main
Quote:
Originally posted by momo20016
If it was 'incorrect' than it wouldn't work. And since it isn't incorrect hence the reason why almost evey compiler in the world accept the statement void main without flashing any errors or warnings
Code:
#include <stdio.h>
void main ( )
{
printf("ugh\n");
}
Code:
void.c: In function `main':
void.c:4: warning: return type of `main' is not `int'
Re: It is not incorrect to use void main
>>If it was 'incorrect' than it wouldn't work.
Umm i am not going to read this whole thread, but i want to comment on this line.
Ever tried to thread a metric bolt into a standerd whole, or the other way around? Well MOST of the time it won't work, because its backwards and incorrect, but every now and then, it works. Does this now make it correct? No it doesn't.