Array of char pointers.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




If I had to say what "arr" is, I would say it is an array of pointers
to chars. If so why is it intialized with strings instead of
addresses?

char *arr[] =
{
"a", "b", "c","dd", "eee"
};

Also when looking at the values of the pointers (when they appear to
be adjacent) they seem to decrease by at least 8 bytes ( two native
size words?) even when the strings are a single character, which
should be two bytes. So I am guessing they are on a stack if the
addresses decrease but why 8 bytes each? Is it some type of linked
list? I suppose it doesn't really matter but it is a curiosity and I
am interested in how the language works.

Thanks,

gtb
.



Relevant Pages

  • Re: Big Strings
    ... > I am looking at strings in Delphi and see that larger than 255 chars is ... > with PChars or Pointers. ... I want to read and write multiple strings larger ...
    (alt.comp.lang.borland-delphi)
  • Re: A taxonomy of types
    ... however, elsewhere in my project (off in the dynamic typesystem, ...), I ... (since I am using NULL-terminated strings), and so I have used U+10FFFF ... remember, C also has things like arrays, funtion pointers, nestable ... int RIL_TypeSmallIntP; ...
    (comp.lang.misc)
  • Re: new IL: C (sort of...).
    ... only for "recent" Pascals, ... far pointers weren't really limited, ... in my compiler, I made wchar_t a builtin type (in most cases, aliased to ... I could very well include builtin "managed strings" in the new IL. ...
    (comp.lang.misc)
  • Re: HeapFree() Failing to deallocate string
    ... I've been able to recreate and isolate the problem with HeapFree(), ... in this simplified example is just a pointer to 16 bytes to store pointers ... the szCaption strings need to be copied to the pointed to ... strings for which storage needs to be allocated, ...
    (microsoft.public.windowsce.embedded)
  • Re: Increasing efficiency in C
    ... >> The representation of a string in C is the sequence of characters, ... strings, they are passed the addresses of strings. ... supports pointers the way it does. ... Competent programmers make mistakes, too. ...
    (comp.lang.c)