hello, i am using keil uvision 4.0 for my 8051 projects.i am getting an error whenever i use the pre defined word 'else' in my code. ex:
if(an1==1)
{
LED1=1;
LED2=1;
else //at this point//
LED1=0;
LED2=0; }
it shows an error C141. Can you please help me out..
sure, but your problem show such a lack of understanding the basic C concepts, not to mention that you are unable to follow instructions (re posting code), that helping you would make you come back with an equally basic problem in a few minutes
get a C book, study it
Erik
Learn how to use/apply compound statements properly.
if(an1==1) { LED1=1; LED2=1; } // Brace here else { // Brace here LED1=0; LED2=0; }
I had the exact same problem when I started!!!!
That was the help I needed. Nice not to get the 'teach a man a fish' crud.
I see no one did teach you to fish - it isn't "teach a man a fish".
But more importantly: do you think it is a bad idea to tell someone that they should spend some time with a book about the C language? In what way is that bad? You prefer that people learn without books - asking about every single aspect of the language on a forum? But how can someone ask about a concept they don't even know exists?
"Nice not to get the 'teach a man a fish' crud."
Yeah, learning the language -- that's so lame.
We could fix your syntax errors faster if you publish your code to a public repository for us to directly edit.
View all questions in Keil forum