I am getting an error for void main() function.. Please help me. I am using AT89C51.
I'm not sure you've provided anywhere near enough context to provide a useful answer. You'll need to examine your code, and determine if it's actually compliant C code.
You might consider :
int main(void) { // .. while(1); }
You might NOT consider :
main() can not return a valus
Well, it can - but, in this case, it should not!
while(1); does not return
Generally compilers special case the treatment of main(), assuming it returns an int, and not fussing overly in the absence of the return keyword.
The behaviour if it does return/exit depends on the startup code, but in embedded systems it not usually desirable as there is no-where for the exit code to be propagated too, and the system will either crash, lock, reset, or fail in some manner.
View all questions in Keil forum