Re: 2-dimensional arrays and functions

From: Mike Wahler (mkwahler_at_mkwahler.net)
Date: 10/31/03


Date: Fri, 31 Oct 2003 15:19:40 GMT


"Jumbo" <(nospam)@12freeukisp.co.uk> wrote in message
news:1067553083.830627@news.minx.net.uk...
> At least I have posted 3 good examples of how to do it which I don't see
any
> comments about so I assume they are OK. The only other person who tried to
> help the OP was Mike I think but he went into function pointer land

My example did not use any function pointers.

> and I
> was looking for a simpler answer.

The question was:

"I am trying to pass a 2-dimensional array to a function and return a
pointer to a 2-dimensional array."

What I posted is the simplest way I know of returning a
pointer to an array from a function.

>
> Here are my examples again incase you missed it in this pointer
pandemonium:

None of those examples use any pointers to arrays.

-Mike



Relevant Pages

  • Re: char **argv & char *argv[]
    ... "pointer to pointer to char". ... >> pointer)) pointing to the first element of an array. ... so we have to start adding more context. ... type "pointer to char", rather than "array MISSING_SIZE of char". ...
    (comp.lang.c)
  • Re: multi dimensional arrays as one dimension array
    ... please - where does the standard say that such a conversion ... Pointer conversion yields a pointer to the same object as ... exist only where there are array declarations. ...
    (comp.lang.c)
  • Re: Evaluating unary *
    ... 'arr' exists, ... value can be used with the same syntax as would be used to access a 2D array of the kind you're referring to, but that 2D array is just a different way of looking as the same object that was already created by the definition of 'arr'. ... to me, it makes sense to return a pointer to the first value of an array, but to return the address of the pointer to the first value of an array, is not directly possible as such. ... lea eax, ...
    (comp.std.c)
  • Re: Banks and economy
    ... Such a declarator makes the contained identifier ... "array of" specification are adjacent, ... type', and as I quoted to Phil, the incomplete type can't be ... parameters since array types used there are converted to pointer types. ...
    (alt.lang.asm)
  • Re: "Mastering C Pointers"....
    ... A pointer is a kind of variable that can "point to" some object. ... has a type (pointer to int), and a value of some kind. ... You may know that you can access these integers by using array notation ... The function will take one argument, a string, and will return the length ...
    (comp.lang.c)