17.Remove hallo marry and run in gcc, find nothing display.
18.eturn 0;
hallo.c: In function ‘main’:
hallo.c:6:10: error: expected ‘;’ before ‘}’ token
6 | return 0
| ^
| ;
7 | }
| ~
18.Remove {} curly bracket and find the error.
hallo.c: In function ‘main’:
hallo.c:5:2: error: expected declaration specifiers before ‘printf’
5 | printf("hello marry\n");
| ^~~~~~
hallo.c:6:2: error: expected declaration specifiers before ‘return’
6 | return 0
| ^~~~~~
Program Hello.C
OpenSymbol">•
Bug 1
Missing # from
#include
hello.c:1:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘<’ token
include
<stdio.h>
OpenSymbol">•
Bug 2
Missing < from
<stdio.h>
hello.c:1:10: error: #include expects "FILENAME" or <FILENAME>
#include stdio.h>
^
hello.c: In function ‘main’:
hello.c:4:9: warning: implicit declaration of function
‘printf’ [-Wimplicit-function-declaration]
printf("Hello /n");
^
hello.c:4:9: warning: incompatible implicit declaration of
built-in function ‘printf’
hello.c:4:9: note: include ‘<stdio.h>’ or provide a
declaration of ‘printf’
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 3
Missing > from
< stdio.h>
hello.c:1:18: error: missing terminating > character
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 4
Missing ‘.’ from
stdio.h
hello.c:1:18: fatal error: stdioh: No such file or directory
compilation terminated.
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 5
Missing ( from int
main()
hello.c:2:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘)’ token
int main)
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 6
Missing ) from int
main()
hello.c:3:1: error: expected declaration specifiers or ‘...’ before ‘{’
token
{
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 7
Unopended }
hello.c:4:9: error: expected declaration specifiers before ‘printf’
printf("Hello
/n");
^
hello.c:5:2: error: expected declaration specifiers before
‘return’
return 0;
^
hello.c:6:1: error: expected declaration specifiers before
‘}’ token
}
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 8
Unopened ()
hello.c: In
function ‘main’:
hello.c:4:15: error: expected ‘;’ before string constant
printf"Hello /n");
^
hello.c:4:25: error: expected statement before ‘)’ token
printf"Hello /n");
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 9
Unopened double
quote “
hello.c: In
function ‘main’:
hello.c:4:16: error: ‘Hello’ undeclared (first use in this
function)
printf(Hello
/n");
^
hello.c:4:16: note: each undeclared identifier is reported
only once for each function it appears in
hello.c:4:24: warning: missing terminating " character
printf(Hello
/n");
^
hello.c:4:9: error: missing terminating " character
printf(Hello
/n");
^
hello.c:4:23: error: ‘n’ undeclared (first use in this function)
printf(Hello
/n");
^
hello.c:5:2: error: expected ‘)’ before ‘return’
return 0;
^
hello.c:6:1: error: expected ‘;’ before ‘}’ token
}
^
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 10
Unclosed
double quotes ”
hello.c:
In function ‘main’:
hello.c:4:16: warning: missing terminating " character
printf("Hello \n);
^
hello.c:4:9: error: missing terminating " character
printf("Hello \n);
^
hello.c:5:2: error: expected expression before ‘return’
return 0;
^
hello.c:6:1: error: expected ‘;’ before ‘}’ token
}
^
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 11
Single quotes ‘’
instead of double quotes “”
hello.c: In
function ‘main’:
hello.c:4:16: warning: character constant too long for its
type
printf('Hello
\n');
^
hello.c:4:16: warning: passing argument 1 of ‘printf’ makes
pointer from integer without a cast [-Wint-conversion]
In file included from hello.c:1:0:
/usr/include/stdio.h:362:12: note: expected ‘const char *
restrict’ but argument is of type ‘int’
extern int printf
(const char *__restrict __format, ...);
^
hello.c:4:9: warning: format not a string literal and no
format arguments [-Wformat-security]
printf('Hello
\n');
^
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 12
Unclosed ) braces
hello.c: In
function ‘main’:
hello.c:4:16: warning: missing terminating " character
printf("Hello \n;
^
hello.c:4:9: error: missing terminating " character
printf("Hello \n;
^
hello.c:5:2: error: expected expression before ‘return’
return 0;
^
hello.c:6:1: error: expected ‘;’ before ‘}’ token
}
^
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 13
Missing semi
colon ;
hello.c: In
function ‘main’:
hello.c:4:16: warning: missing terminating " character
printf("Hello \n)
^
hello.c:4:9: error: missing terminating " character
printf("Hello \n)
^
hello.c:5:2: error: expected expression before ‘return’
return 0;
^
hello.c:6:1: error: expected ‘;’ before ‘}’ token
}
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 14
Colon instead : of
semi colon ;
hello19.c:
In function ‘main’:
hello.c:4:27: error: expected ‘;’ before ‘:’ token
printf("Hello \n"):
^
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 15
0
missing from return statement
hello.c: In function ‘main’:
hello.c:5:2: warning: ‘return’ with no value, in function
returning non-void
return ;
^
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 16
Missing Semi colon
; after return statement
hello.c:
In function ‘main’:
hello.c:6:1: error: expected ‘;’ before ‘}’ token
}
^
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 17
Colon instead
of semi Colon at the end of return statement
hello.c: In
function ‘main’:
hello.c:5:10: error: expected ‘;’ before ‘:’ token
return 0:
^
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 18
Unclosed Braces } at
the end
hello.c: In
function ‘main’:
hello.c:5:2: error: expected declaration or statement at end
of input
return 0;
^
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 19
Upper Case P
instead of lower Case p in printf statement
hello.c: In
function ‘main’:
hello.c:4:9: warning: implicit declaration of function
‘Printf’ [-Wimplicit-function-declaration]
Printf("Hello \n");
^
/tmp/cc9oA1Rp.o: In function `main':
hello.c:(.text+0xf): undefined reference to `Printf'
collect2: error: ld returned 1 exit status
OpenSymbol;mso-bidi-font-weight:bold">•
Bug 20
Upper Case R
instead of lower case r in return statement
hello.c: In
function ‘main’:
hello.c:5:2: error: ‘Return’ undeclared (first use in this
function)
Return 0;
^
hello.c:5:2: note: each undeclared identifier is reported
only once for each function it appears in
hello.c:5:9: error: expected ‘;’ before numeric constant
Return 0;
^
It looks like you're new here. If you want to get involved, click one of these buttons!