1

I am writing a program and I get the following error message:

error: stray ‘\344’ in program

What does this means?

Here is the program:

int lotto, zahl, i;
double produktlotto, produktzähl, binominalkoffizient, differenz;
i=1, lotto=0, zahl=0, produktlotto=1, produktzahl=1;
double produktdiffierenz
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ismail
  • 33
  • 4
  • You might like to read [C11 5.2.1](http://port70.net/~nsz/c/c11/n1570.html#5.2.1) :) – pmg Aug 31 '19 at 10:18
  • 1
    you named the second double variable `produktzähl`, but `ä` is not a valid character in c variable names. – René Vogt Aug 31 '19 at 12:31
  • 2
    To answer your question literally, `\344` stands for “the value of the octal numeral 344” (decimal 228). It most often appears as an “escape code” for a character in a character constant or string literal. The compiler is telling you there is a character with code 228 in the source file that it does not like. – Eric Postpischil Aug 31 '19 at 12:58
  • Note: you, your source code editor and compiler must have a shared understanding of the "[source-charset](https://learn.microsoft.com/en-us/cpp/build/reference/source-charset-set-source-character-set)" aka "[input-charset](http://gcc.gnu.org/onlinedocs/cpp/Character-sets.html)". Perhaps your compiler would accept the character if it was reading it with the character encoding you are using. – Tom Blodget Aug 31 '19 at 18:20
  • 344 octal = 228 decimal = 0xE4. E4 in CP-1250 is "ä" (Unicode code point U+00E4 ([LATIN SMALL LETTER A WITH DIAERESIS](https://www.utf8-chartable.de/))) – Peter Mortensen Mar 06 '21 at 21:51
  • Specifically, in `produktzähl`. – Peter Mortensen May 05 '23 at 23:42

1 Answers1

2

German umlaute like ä, ö, ü, ß are not supported in C / C++. Always and only use characters of the ASCII-Table in your code! Removing the umlaut will resolve your error!

itzFlubby
  • 2,269
  • 1
  • 9
  • 31
  • 5
    This is not an accurate statement of what is required or allowed by the C standard. Compilers are **allowed** to support additional characters—Clang allows “ä” in identifiers. Compilers are **required** to support the characters listed in C 2018 5.2.1—that does not include the “grave accent” “`”, but it is ASCII character 0x60. – Eric Postpischil Aug 31 '19 at 12:56
  • 1
    Advantages of the advice aside, it gives the false impression that C is tied to ASCII. – Tom Blodget Aug 31 '19 at 18:16
  • [GCC caught up in version 10](https://stackoverflow.com/questions/12692067/and-other-unicode-characters-in-identifiers-not-allowed-by-g/42158646#42158646) (mid 2020). – Peter Mortensen May 05 '23 at 23:45