0

I am writing a program in which I am initializing a char array as follows

char array[28] = "\19TTTxxxxxxx Protocol\x00\x00\x00\x00\x00\x00\x00\x00";

But the above statement gives a warning that "initializer string too long ". But when I change it to \20, it doesn't give the warning.

Can someone explain whats going on here?

0

1 Answer 1

2

"\20" is a single character with octal value 020. "\19" is two characters, the first having octal value 01 and the second being '9'.

9 is not an octal digit.

Sign up to request clarification or add additional context in comments.

1 Comment

For more detail, check out the spec, section 6.4.4.4 Character constants.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.