Re: Is char*[] convertible to const char*[]?



kevin.hall@xxxxxxxxxxxxx wrote:
> > There is a faq on this.
>
> Do you mind pointing me to it? The only FAQ item I've ever seen is
> about converting non-arrays -- something like char* to const char*.

http://www.eskimo.com/~scs/C-faq/q11.10.html

What you're probably missing is that...

int main(int argc, char *argv[])

....is identical to...

int main(int argc, char **argv)

C cannot pass whole arrays, instead it passes pointers to the
first element. Hence, function parameters declared as arrays
are silently treated as pointers.

--
Peter

.



Relevant Pages

  • Re: char vs int
    ... 'a' is a character constant. ... A variable of type char can ... of them instead of int arrays. ... concept of pointers. ...
    (comp.lang.c)
  • Re: simple question regarding 5.5 of Ritchie & Kernighan
    ... pointers to char and arrays of char: ... a memory address to hold the value it points to and that memory address ... runtime) multidimensional arrays. ... arrays of pointers to arrays, ...
    (comp.lang.c)
  • Re: pointers and files
    ... I'm wrk prj C. ... > address as that of the first char. ... pointers to FILE ... C++ Faq: http://www.parashift.com/c++-faq-lite ...
    (comp.lang.c)
  • Re: Your view of FAQ section.
    ... my question is this - how do you feel about the way the FAQ ... We already now that pointers and arrays ... But should the FAQ really go into detail about how the compiler ...
    (comp.lang.c)
  • Re: Newbie, 2d array declaration, init... question
    ... it's polite to include relevant quotes from previous ... Please read chapter 6 'Pointers and Arrays' of the FAQ. ...
    (comp.lang.c)