We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
i am facing error C141: syntax error near '}'
my program is given below:
#include<reg51.h> void main ( ) { int x; while (1) { P1 = 0x00 ; for (x=0 ; x<=5000 ; x++) P1 = 0xFF ; for (x=0 ; x<=5000 ; x++) } }
any one can help me how to solve it
IF the OP really can't spot something as clearly & obviously stated as the posting instructions, that tends to suggest a lack of attention that is really going to hamper their progress with any sort of programming - and embedded programming in particular.
You may call it a "little thing", but it is precisely such sloppiness with the "little things" - in this case, just one "little" semicolon - that is the cause of the problem reported in the OP's post!
When it comes to compilers (and circuits, for that matter) the "little things" really do matter - the compiler will not cut you any slack because you're a beginner and it's "only" one "little" semicolon...
When it comes to compilers (and circuits, for that matter) the "little things" really do matter.
Well, technically, the little things that matter to the compiler are the things that matter to the compiler. Formatting tags useful for posts here are not relevant to the compiler, therefore they do not matter to the compiler.
But pointing out all the little things without spotting the big thing staring you in the face is just plain unforgivable - Surely you would not disagree?
You missed the point entirely!
The point is that the inability to follow simple, clearly-stated instructions is symptomatic of a fundamental problem in the OP's approach.
I think their point is, yes, if that was the only person to ever post here and they only had to answer that one question, it's readable.
But since many people come here asking for help with bad formatting, they're trying to make a consistent rule to have everyone format it a certain way. This time it might not matter (even though expanding it in THIS case very easily shows the issue with the code) but if they don't correct the person now, they might come back with more complicated code next time and not format it correctly and no one will be able/willing to help him.
It serves multiple purposes:
1) To possibly help the person posting the code by being able to look at it formatted correctly (though if it's being posted here, it's unlikely that's going to be the case) 2) To make it easier for the people providing help to read it 3) To show a basic level of consideration/consistency when posting. If the person is unwilling to follow directions THAT specifically outlined (and reinforced by multiple posters here), it's unlikely that any help provided will be able to help the person a) solve their problem or b) become a better programmer.
The posters here are trying to help people find the problems and UNDERSTAND what they're solving, not to simply hand them a solution without them UNDERSTANDING what the problem is.
So yeah, you can argue all you want about it, you could even be right about it but at the end of the day, if the people providing you help ask for something, you can question or fight them about it (and end up in the huge tangent displayed here) or you can just follow their suggestion and move on and I'm sure they'll be happy to help you with your code at that point.
But realistically, if you try to help someone and they fight you over it, how likely are you to continue helping someone?
No. I was replying to your rather sloppy description of what matters to a compiler.