Passing Multi-dimensional arrays to a function

Dave Eisen dkeisen at Gang-of-Four.Stanford.EDU
Sat Jul 21 00:24:08 AEST 1990


In article <1990Jul19.112403.709 at DRD.Com> tdh at drd.Com (Tom Haynes) writes:
>volpe at underdog.crd.ge.com (Christopher R Volpe) wrote:
>} >    cischa(pnlptr, "PREFIX", 0, SCREEN, prefix[curr]);
>} *                                         ^^^^^^^^^^^^
>} *         prefix[curr] is of type (char *) whereas the formal parameter
>} *         is of type (char **). Maybe you wanted "&prefix[curr]"???
>} *
>
>I tried that, along with &prefix[curr][0], both were no go.
>Error message was something like '& not allowed on struct/array'.
>

Many compilers don't take &prefix[curr] when prefix[curr] is an array,
you can use prefix + curr instead.

But prefix + curr is still of type pointer to array of char, the
formal paramter is of type pointer to pointer of char; the types
still don't match.



--
Dave Eisen                      	    Home: (415) 323-9757
dkeisen at Gang-of-Four.Stanford.EDU           Office: (415) 967-5644
1447 N. Shoreline Blvd.
Mountain View, CA 94043



More information about the Comp.lang.c mailing list