C does not, at bottom, have strings. It views them as arrays of single characters.
When it was realized that this is at best a dubious notion, nul-delimited strings were grafted on to the structure of C, and the scar tissue shows. It is, however, possible to declare a string without specifying its length, using its initializing value to specify its length implicitly. Thus char animal_name[] = 'wombat' ; yields a six-character string that occupies seven characters of storage inclusive of its EOS delimiter, x'00' or nul. The constructions char animal_name[5] = {'w','o','m','b','a','t'} char animal_name[5] = 'wombat' ; are rejected because their initializing values are incompatible with their length specifications. Elsewhere--in PL/I and its dialects, DB2, etc--strings are of two different sorts, non-varying and varying, are also supported. Varying strings are prefixed by, usually, a halfword current-length indicator. Thus in PL/I declare example character(254) varying ; yields a string occupying 256 bytes, a halfword prefix followed by at most 254 value bytes, with 0 <= currentlength(example) <= 254. John Gilmore, Ashland, MA 01721 - USA ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN