Why define \0 as the first element of a char array in C?
Solution 1:
In your particular case this array is used as pathname for a PF_LOCAL
socket; see here. And leading NUL is used to point that address is an abstract one. From man 7 unix:
an abstract socket address is distinguished by the fact that sun_path[0] is a null byte ('\0').
And this is the only reason why the first element is \0
.