\ooo (3 octal digits) really allows you to specify 9-bit values from 0 to 111111111 (binary) or 511. If enabled, it depends on the size of the char .
Assignments, such as below, generate a warning in many environments, since char is 8 bits in these environments. Usually the maximum allowed octal sequence is \377 . But a char should not be 8 bits. The option "9 ... exceeds the byte length required for characters" is invalid.
char *s = "\777"; //warning "Octal sequence out of range" char c = '\777'; //warning int i = '\777'; //warning
The constant with 3 octal digits '\141' same as 'a' in a typical environment where ASCII is used. But in an alternate character set, 'a' may be different. Thus, if you need to assign the portable bit pattern 01100001, you can use '\141' instead of 'a' . One could do the same by assigning '\x61' . In some context, an octal pattern may be preferred.
C11 6.4.4.4.9 If the prefix is not used, "the value of the octal or hexadecimal escape sequence must be in the range of representable values for the corresponding type: unsigned char"
source share