Robert <robert.mue...@robertmuench.de> wrote:

On 2010-05-30 22:16:55 +0200, Pelle <pelle.mans...@gmail.com> said:

&data[0] and &data are very different things, if you have a dynamic array.

Yes, that's what I found out too. What's the exact difference?

Going again with the C code:

typedef struct array {
  int* data;
  int length;
};

You would use an array like this:

void foo( ) {
   array arr;
   arr.ptr = malloc(32);
   arr.length = 8;
}

Now, as you can probbly see, &arr would give the pointer to the
struct, not to the data. Basically, a pointer to pointer to int,
rather than the pointer to int you want.

--
Simen

Reply via email to