C Programming Syntax Error End Input
Programming Boards C Programming Syntax error at end of input Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ syntax error at end of input postgresql | Get a compiler | Fixes for common problems Thread: Syntax error at syntax error at end of input sql end of input Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to syntax error at end of input postgres Hybrid Mode Switch to Threaded Mode 06-16-2009 #1 implor View Profile View Forum Posts Registered User Join Date Jun 2009 Posts 7 Syntax error at end of input I'm getting a "Syntax error at end of input" (last line). but i can't find what's wrong. Code: int main() { int ett; FILE *filen; int val; char filnamn[40]; enum filtyp {db,txt,bin}; typedef enum filtyp filtyp; printf("Skriv filnamn: "); scanf("%s", &filnamn); int i = 0; while( filnamn[i] != '.') { i++; } if(filnamn[i+1] == 't' || filnamn[i+1] == 'T' ) { if((filen = fopen(filnamn, "r")) == NULL) { printf("file don't exist"); exit(1); } binary = 0; } else if (filnamn[i+1] == 'b' || filnamn[i+1] == 'B') { if((filen = fopen(filnamn, "rb")) == NULL) { printf("file don't exist"); exit(1); } binary = 1; } readfil(filen); meny(); close(filen); return 0; } 06-16-2009 #2 Sebastiani View Profile View Forum Posts Guest Join Date Aug 2001 Location Waterloo, Texas Posts 5,708 Well, if you would indent your code properly, you'd see the missing brace... Example: Code: int main( void ) { if( condition ) { foo( ); } else if( some_other_condition ) { while( true ) { bar( ); } } } Or maybe: Code: int main( void ) { if( condition ) { foo( ); } else if( some_other_condition ) { while( true ) { bar( ); } } } Code: #include
Programming Boards C Programming "Syntax error at end of input" Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | Fixes for common problems Thread: "Syntax error at end of input" Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 08-05-2007 #1 yougene View Profile View Forum Posts Registered User Join Date May 2006 Posts 182 "Syntax error at end of input" When I try to compile this code it tells me there is a http://cboard.cprogramming.com/c-programming/116886-syntax-error-end-input.html "syntax error at end of input" at line 21. This makes no sense to me, the code is as simple as it can be. What's going on here? Code: #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or http://stackoverflow.com/questions/15844622/syntax-error-expected-declaration-at-end-of-input posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join http://stackoverflow.com/questions/13119786/syntax-error-at-end-of-input-in-postgresql the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Syntax Error: expected declaration at end of input up vote -4 down vote favorite I keep getting a strange syntax error that i've never seen before, and I'm not sure what's the problem with it. Can I syntax error get some extra eyes to help me figure out what the problem is? the error reads: error: expected declaration or statement at end of input the bold line is what it highlights as the error. void draw(int deck[SIZE]) { int i; for(i = 0; i < 5; i++) { cards; putchar('\n'); } void cards() { char suits[4][9] = { "Hearts", "Diamonds", "Clubs", "Spades"}; for(i=0; i here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Syntax error at end of input in PostgreSQL up vote 7 down vote favorite 1 I have used the next SQL statement in both MySQL and PostgreSQL, but it fails in PostgreSQL db.Query(`SELECT COUNT(*) as N FROM email WHERE address = ?`, email) with this error: pq: F:"scan.l" M:"syntax error at end of input" S:"ERROR" C:"42601" P:"50" R:"scanner_yyerror" L:"993" What's the problem? The error messages in PostgreSQL are very cryptic. sql postgresql go share|improve this question edited Oct 29 '12 at 10:40 dandan78 7,50973762 asked Oct 29 '12 at 10:26 user1243746 2 What language are you coding in? I mean the client language, not the SQL. –Mark Byers Oct 29 '12 at 10:28 1 What database client are you using? That cryptic error is much more to do with the database client than the database server. If I prepare that statement it's fine, so the issue is most likely with your programming language or database adapter. Try it in psql. PREPARE q AS SELECT COUNT(*) as N FROM email WHERE address = $1; then EXECUTE q;. $1 is the placeholder syntax for PREPARE, but your programming language probably uses ?; otherwise there's no difference. –Craig Ringer Oct 29 '12 at 10:29 add a comment| 3 Answers 3 active oldest votes up vote 15 down vote accepted You haven't provided any details about the language/environment, but I'll try a wild guess anyway: MySQL's prepared statements natively use ? as the parameter placeholder, but PostgreSQL uses $1, $2 etc. Try replacing the ? with $1 and see if it works: WHERE address = $1 The error messages in PostgreSQL are very cryptic. In general, Postgres error messages are very clear, but in this instance you'