Assignment 1: Find 20 distinct error in Hello World Programe.
1. Missing "#" hello.c:2:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token include<stdio.h> ^
2. Spelling mistake #nclude<stdio.h> hello.c:2:2: error: invalid preprocessing directive #nclude #nclude<stdio.h> ^ hello.c: In function ‘main’: hello.c:9:2: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] printf("Hello,World!\n"); ^ hello.c:9:2: warning: incompatible implicit declaration of built-in function ‘printf’ hello.c:9:2: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
3. Wrong Library name #include<tdio.h> hello.c:2:17: fatal error: tdio.h: No such file or directory compilation terminated.
4. wrong spell of data type int "nt" hello.c:4:1: error: unknown type name ‘nt’ nt main () ^
5. wrong spell main "ain" /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status
6.White space missing intmain() hello.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int] intmain () ^ /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status
7.wrong spell i ntmain() hello.c:4:1: error: unknown type name ‘in’ in tmain() ^
8. wrong written int m ain() hello.c:4:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ain’ int m ain() ^ 9. No braces after int main hello.c:6:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token { ^
10. Missing opening curly braces int main () "{" hello.c: In function ‘main’: hello.c:9:2: error: expected declaration specifiers before ‘printf’ printf("Hello,World!\n"); ^ hello.c:11:2: error: expected declaration specifiers before ‘return’ return 0; ^ hello.c:12:1: error: expected declaration specifiers before ‘}’ token } ^ hello.c:12:1: error: expected ‘{’ at end of input
11. int main(); hello.c:6:1: error: expected identifier or ‘(’ before ‘{’ token { ^ 12. missing * after / in commenting hello.c: In function ‘main’: hello.c:8:2: error: expected expression before ‘/’ token / my first Programe in C */ ^ 13. Missing / before * in commenting hello.c:8:4: error: ‘my’ undeclared (first use in this function) * my first Programe in C */ ^ hello.c:8:4: note: each undeclared identifier is reported only once for each function it appears in hello.c:8:7: error: expected ‘;’ before ‘first’ * my first Programe in C */ ^
14.wrong function spell rint( hello.c:10:2: warning: implicit declaration of function ‘rintf’ [-Wimplicit-function-declaration] rintf("Hello,World!\n"); ^ hello.c:10:2: warning: incompatible implicit declaration of built-in function ‘rintf’ hello.c:10:2: note: include ‘<math.h>’ or provide a declaration of ‘rintf’ hello.c:10:8: error: incompatible type for argument 1 of ‘rintf’ rintf("Hello,World!\n"); ^ hello.c:10:8: note: expected ‘float’ but argument is of type ‘char *’
15.missing braces after printf hello.c: In function ‘main’: hello.c:10:8: error: expected ‘;’ before string constant printf"Hello,World!\n"); ^ hello.c:10:24: error: expected statement before ‘)’ token printf"Hello,World!\n");
^
16.missing braces after " in printf hello.c: In function ‘main’: hello.c:10:9: warning: missing terminating " character printf("Hello,World!\n); ^ hello.c:10:2: error: missing terminating " character printf("Hello,World!\n); ^ hello.c:12:2: error: expected expression before ‘return’ return 0; ^ hello.c:13:1: error: expected ‘;’ before ‘}’ token } ^
17. terminating before braces in printf hello.c: In function ‘main’: hello.c:10:25: error: expected ‘)’ before ‘;’ token printf("Hello,World!\n";) ^ hello.c:12:2: error: expected ‘;’ before ‘return’ return 0; ^ 18.wrong spell return as eturn hello.c: In function ‘main’: hello.c:12:2: error: ‘eturn’ undeclared (first use in this function) eturn 0; ^ hello.c:12:2: note: each undeclared identifier is reported only once for each function it appears in hello.c:12:8: error: expected ‘;’ before numeric constant eturn 0; ^ 19. r eturn 0; hello.c: In function ‘main’: hello.c:12:2: error: unknown type name ‘r’ r eturn 0; ^ hello.c:12:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before numeric constant r eturn 0;
^
20. retun0; hello.c: In function ‘main’: hello.c:12:2: error: ‘return0’ undeclared (first use in this function) return0; ^ hello.c:12:2: note: each undeclared identifier is reported only once for each function it appears in
21. retun with no value hello.c: In function ‘main’: hello.c:12:2: warning: ‘return’ with no value, in function returning non-void return ; ^
22. missed ; after retun 0 hello.c: In function ‘main’: hello.c:13:1: error: expected ‘;’ before ‘}’ token } ^
23.missed closing main function through curly braces
hello.c: In function ‘main’: hello.c:12:2: error: expected declaration or statement at end of input return 0; ^
24. Extra ; after #include<stdio.h> hello.c:2:18: warning: extra tokens at end of #include directive #include<stdio.h>; ^