Do string literals that end with a null-terminator contain an extra null-terminator?

All string literals have an implicit null-terminator, irrespective of the content of the string.

The standard (6.4.5 String Literals) says:

A byte or code of value zero is appended to each multibyte character sequence that results from a string literal or literals.

So, the string literal "abc\0" contains the implicit null-terminator, in addition to the explicit one. So, the array a contains 5 elements.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)