Why can't my C code be compiled using GCC?
c, gcc
Solution
You get those errors because you presumably copy and pasted that code from a formatted source. `“` and `”` aren't the same as `"`. Change them to that and the code will compile.
You should probably also follow the convention of having main defined as:
int main(void)
and therefore returning an `int`.
Problem
I have some simple code in C: ``` #include <stdio.h> main() { printf(“Hello, World! /n”); } ``` But I can't compile it in GCC. When I try to compile it, the warning is: ``` 1. gcc hello.c -o hello 2. hello.c: In function 'main: 3. hello.c:4:1: error: stray '\342' in program 4. hello.c:4:1: error: stray '\200' in program 5. hello.c:4:1: error: stray '\234' in program 6. hello.c:4:11: error: 'Hello' undeclared (first use in this function) 7. hello.c:4:11: note: each undeclared identifier is reported only once for each function it appears in 8. hello.c:4:18: error: 'World' undeclared (first use in this function) 9. hello.c:4:23: error: expected ')' before '!' token 10. hello.c:4:23: error: stray '\342' in program 11. hello.c:4:23: error: stray '\200' in program 12. hello.c:4:23: error: stray '\235' in program ``` How can I fix it?