belongs to collection: C Common Errors Programs
The main cause of this error is – missing closing curly brace (}) of the main() block.
Example:
#include <stdio.h> int main(void){ printf("Hello world"); return 0;
Output
prog.c: In function ‘main’: prog.c:5:2: error: expected declaration or statement at end of input return 0; ^~~~~~
In this program, closing brace of the main() block is missing
How to fix?
To fix this and such errors, please take care of curly braces, they are properly opened and closed.
Correct code:
#include <stdio.h> int main(void){ printf("Hello world"); return 0; }
Hello world
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Example:
Output
In this program, closing brace of the main() block is missing
How to fix?
To fix this and such errors, please take care of curly braces, they are properly opened and closed.
Correct code:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer