[OCLUG-devel] Initializing Strings
Michael Elkins
michael.elkins at gmail.com
Thu Sep 8 11:16:19 PDT 2005
On 9/8/05, Doug Jolley <ddjolley at gmail.com> wrote:
> Anyway, my question is, in the first case, is my textbook wrong and there
> is no automatically supplied null character? As I said, that appears to be
> the case and I hope that it is -- or, am I missing something?
>From what I remember, the textbook is correct. gcc seems to add the
null character.
You are initializing from a string. If you want an array of
character, you can do this:
char string2[40] = {'D','o','u','g'};
Although, I seem to remember that in some cases the rest of the array
gets filled (or was that struct assignment?).
Michael
More information about the OCLUG-devel
mailing list