C4418: Illegal escape sequence

[ERROR]

Description

An illegal escape sequence occurred. A set of escape sequences is well defined in ANSI C. Additionally there are two forms of numerical escape sequences. The compiler has detected an escape sequence which is not covered by ANSI. Note: The pragma MESSAGE does not apply to this message because it is issued in the preprocessing phase.

Example
  char c= '\\p';

  
Tips

Remove the escape character if you just want the character. When this message is ignored, the compiler issued just the character without considering the escape character. So '\p' gives just a 'p' when this message is ignored. To specify and additional character use the either the octal or hexadecimal form of numerical escape sequences.

  char c_space1= ' '; // conventional space

  
  char c_space2= '\x20'; // space with hex notation

  
  char c_space3= '\040'; // space with octal notation

  
  \encode

  
  Only 3 digits are read for octal numbers, so when you 
  specify 3 digits, then, there is no danger of combining 
  the numerical escape sequence with the next character in 
  sequence. Hexadecimal escape sequences should be 
  terminate explicitly.

  
  \code

  
  const char string1[]= " 0";// gives " 0"

  
  const char string2[]= "\400";// error because 0400> 255

  
  const char string3[]= "\x200";// error because 0x200 > 
  255

  
  const char string4[]= "\0400";// gives " 0"

  
  const char string5[]= "\x20"  "0";// gives " 0"

  

See also