Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

“error: stray '\342' ”, “stray '\200' ”, “stray '\213' ” in C compiling

Tags:

c

Here is my code

int main()​
{
    float avg, age[] = { 23.4, 55, 22.6, 3, 40.5, 18 };
    avg = average(age); /* Only name of array is passed as argument. */
    printf("Average age=%.2f", avg);
    return 0;
}

Compilation error in int main():

error: stray '\342' in program
error: stray '\200' in program
error: stray '\213' in program
like image 921
Nadim Tareq Avatar asked Dec 11 '25 04:12

Nadim Tareq


2 Answers

You have "crap characters" in your source file.

\342 \200 \213 is octal for 0xE2 0x80 0x8B which is a zero width space in UTF-8 (Unicode U+200B), something no C compiler can make sense of (and something you can't see, zero-width after all, when UTF-8 is displayed correctly).

-> Use a text or code editor (even Windows' Notepad should do, if not saving as UTF-8, but any other editor would be better) and/or an integrated development environment to write your code. Don't ever use word processors or the like, that might introduce unwanted characters.

Use the following website. It will show you bad characters and then remove them:

View non-printable Unicode characters

like image 41
Mahmoud Mabrok Avatar answered Dec 13 '25 21:12

Mahmoud Mabrok



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!