Re: Any help?
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Thu, 19 Jan 2006 23:22:54 GMT
"Vladimir S. Oka" <novine@xxxxxxxxxxxxxx> writes:
[...]
> In the context of OP's original question, which was:
>
> cj wrote:
> > Which would be true? The size of the array would be reduced to 10 or
> > the array size stays at 80 and the string fills array locations,
> > starting at array [0].
>
> I'd still say that array elements past the first 0, are "unused",
> i.e. the array stays the size 80 _and_ the string fills its locations
> starting with array[0].
If you use the array as a string (e.g., by passing the address of its
first element to printf() or strlen()), the array elements past the
first 0 will be unused. But since the language guarantees that all
those elements will be initialized to '\0', a program can legally use
them, and can depend on their initial values. (Not any program that
I'd wrote, though.)
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- Follow-Ups:
- Re: Any help?
- From: Haroon Shafiq
- Re: Any help?
- References:
- Any help?
- From: cj
- Re: Any help?
- From: tedu
- Re: Any help?
- From: Vladimir S. Oka
- Re: Any help?
- From: Eric Sosman
- Re: Any help?
- From: Vladimir S. Oka
- Any help?
- Prev by Date: Re: using "!!" in "c"
- Next by Date: Re: using "!!" in "c"
- Previous by thread: Re: Any help?
- Next by thread: Re: Any help?
- Index(es):
Relevant Pages
|