Thread: syntax error at end of input

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    11

    syntax error at end of input

    hi guys, i keep getting the 'syntax error at end of input', but I can't see anything wrong.

    Code:
    void
    middle(void){
    	array_t midpoint[HEIGHT][WIDTH];
    	int s, t;
    	for(s=0;s<HEIGHT-1;s++){
    	      for(t=0;t<WIDTH-1;t++){
    		midpoint[s][t].y=s+.5;
    		midpoint[s][t].x=t+.5;
    		printf("%5lf ", midpoint[s][t].x);
    		}
    	}
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    My guess is a missing brace, semi-colon, quote (or anything else that needs to be balanced).
    Look at the previous function.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    11
    lol... I forgot to put the closing bracket on the previous function...so it was including the next function in it.

  4. #4
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    syntax error at end of input
    Usually means it's an error at the end of the file. Is what you posted the end of the file? Check your brackets. Make sure you have semicolons after all the function and struct declarations. Open the file in a syntax-highlighting editor, check for opening quotation marks or block comments with no matching closing quotes or comments. Or post the whole file if it's not 6 million lines long.

    EDIT: Why do I always take so long to type a response?
    Consider this post signed

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you help me about tolower() in file
    By nctar in forum C Programming
    Replies: 7
    Last Post: 05-12-2010, 10:04 AM
  2. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. How can I read until the end of an input line?
    By Bad_Scooter in forum C++ Programming
    Replies: 4
    Last Post: 07-19-2003, 09:29 PM

Tags for this Thread