# Re: How to increment array of pointers to strings

On Aug 5, 11:39 pm, Eric Sosman <esos...@xxxxxxxxxxxxxxxxxxxx> wrote:
On 8/5/2010 11:02 PM, Shao Miller wrote:

On Aug 5, 8:53 pm, barncat<thebarn...@xxxxxxxxx>  wrote:
Thanks All!  My brain hurts after reading and tyring to understand
your explanations. I think i get this now, or at least my program
works now :)  Thanks again
Something else to make your brain hurt: An array has elements of a
fixed size. :)  So you cannot have an array of strings of different
length.[...]

Actually, you can.  Keeping in mind the definitions of "string"
and "string length,"

char array[][6] = { "forty", "two" };
assert (strlen(array[0]) != strlen(array[1]));  // woops!
assert (sizeof(array[0]) == sizeof(array[1]));  // granted ...
Thanks, Eric. :) Let's change it to:

"Something else to make your brain hurt: An array has elements of a
fixed size. :) So you cannot have an array of arrays of 'char' with a
different number of elements for each sub-array."

Of course, one could argue that your array above is _more_ than an
array of strings, due to the padding after the second element. ;)
That is to say, if just one of the strings is long and the others
shorter, the entire array will have lots of padding, so one should be
aware of that.
.

## Relevant Pages

• Re: K&R2 Secition 5.9 - major blunders
... Each element of b doesn't point to a 20 element array of int. ... This mistake is crucial because ... my explanation is really the qualities of something else: ... > The use of the array of pointers is to store the strings. ...
(comp.lang.c)
• Re: K&R2 Secition 5.9 - major blunders
... Each element of b doesn't point to a 20 element array of int. ... This mistake is crucial because ... my explanation is really the qualities of something else: ... > The use of the array of pointers is to store the strings. ...
(comp.lang.c)
• Re: Returning array of strings through callback from unmanaged to
... Is the array of strings a jagged array or fixed length array? ... It is imperative that I am able to return the array of strings from the ... I have control over how many strings I want the unmanaged code to return ... What I want to accomplish is to pass a callback function to unmanaged ...
(microsoft.public.dotnet.framework.compactframework)
• Re: attempting to return values from array from w/in a function
... What I get is an array w/ only the most recent array entry. ... I am new to PHP & do not have formal scripting ... you end up comparing strings, but the test you mean probably is simply: ... case 1: {codeblock} ...
(comp.lang.php)
• Re: Concatenate integer to string
... F2003 adds allocatable-length strings. ... Since a character with allocatable ... It seems that the deferred length has a special proparty, different from a deferred array size, in that the standard assignment operator will allocate the length. ...
(comp.lang.fortran)