Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Initializing arrays of char Message-ID: <1990Oct5.171913.27896@zoo.toronto.edu> Organization: U of Toronto Zoology References: <1990Oct4.152756.6850@micrognosis.co.uk> <15674@csli.Stanford.EDU> Date: Fri, 5 Oct 90 17:19:13 GMT In article <15674@csli.Stanford.EDU> poser@csli.stanford.edu (Bill Poser) writes: >This means that the assignment of "12345" to an array of five characters, >is legal. If K&R2 here reflects the standard, then both initializations >are legitimate. It does; they are. >This seems to me to be a bad idea. Everywhere else, one has to take >into account the terminating null... >... Not counting the terminating null here is inconsistent. >Can anyone explain this decision? It's a special case because this form of initializer is a special case. Normally, assigning a string of any length to an array of char would be illegal. -- Imagine life with OS/360 the standard | Henry Spencer at U of Toronto Zoology operating system. Now think about X. | henry@zoo.toronto.edu utzoo!henry