View Single Post
  #2   Spotlight this post!  
Unread 28-01-2008, 20:28
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: Problem with printf()

Quote:
Originally Posted by Mr. Freeman View Post
I can't find anything wrong with this line or any above it. I don't know why I'm getting a syntax error. Any help would be much appreciated.
In ANSI C, you have to declare all variables before executing any other code in a block. I can't be certain if this is your problem, but try moving the "static int counter = 0;" line above the printf and see if it compiles.

If that is indeed the problem, I would have hoped that C18 would have given a better error message. Sadly, C18 seems to do a poor job with errors in general from what I have seen.