[comp.std.c] Initializing arrays of char

bengsig@oracle.nl (Bjorn Engsig) (10/05/90)

re:  char mesg[5] = "help!"; /* what about the null terminator? */

The ANSI standard says (3.5.7):

"Successive characters of the character string literal (including the 
terminating null character if there is room or if the array is of unknown size)
initialize the elements of the array."

and the rationale mentions:

"(Some widely used implementations provide precedent.)"

further, it fits well with the way strncpy() works.
-- 
Bjorn Engsig,	Domain:		bengsig@oracle.nl, bengsig@oracle.com
		Path:		uunet!mcsun!orcenl!bengsig
		From IBM:	auschs!ibmaus!cs.utexas.edu!uunet!oracle!bengsig