Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: error: initializer element is not constant| Date: Mon, 08 May 2017 09:30:47 -0700 Organization: None to speak of Lines: 23 Message-ID: References: <87lgq7d2ko.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="6d7e0aa3e5b7ac222e8546bcb39ccb10"; logging-data="2569"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Q+STomISt7QqAp8aTJgSy" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:hhIGLyGXBhRq9CcBzID/tIJcL50= sha1:IwUL1sUGF6gRpxvt50BjMg5TmPo= Xref: csiph.com comp.lang.c:109513 Ben Bacarisse writes: [...] > I think you should back-up a bit. How do you plan to use this data? I > ask because "a pointer to a string" is not well-defined in C. In fact it is. > A C > strings are not a type but a format of data (essentially insisting on a > null terminator) so must program represent a "pointer to string" as > char * -- i.e. as a pointer to the first character of the string. N1570 7.1.1p1: A *string* is a contiguous sequence of characters terminated by and including the first null character. [...] A *pointer to a string* is a pointer to its initial (lowest addressed) character. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"