TOGGLE.C(10): error C141: syntax error near '}'

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

Parents
  • Yes we can.

    But why can you not use the correct formatting so we get to see a properly intended source code? Didn't you check the information directly above the message input box?

    Back to your - very hard to read - code: What should a for loop do if you have nothing for it to do? Can a for loop be totally without statement - what does your C programming book say?

    Another thing - what use is it to make 5001 assigns of P1 = 0xFF directly after each other? Exactly how do you think P1 = 0xFF interacts with the for loop?

Reply
  • Yes we can.

    But why can you not use the correct formatting so we get to see a properly intended source code? Didn't you check the information directly above the message input box?

    Back to your - very hard to read - code: What should a for loop do if you have nothing for it to do? Can a for loop be totally without statement - what does your C programming book say?

    Another thing - what use is it to make 5001 assigns of P1 = 0xFF directly after each other? Exactly how do you think P1 = 0xFF interacts with the for loop?

Children
More questions in this forum