# Thread: Arrays with pointers

1. In the integer example, the name "intarr" is the address of the first element, which is the array (1,2). This address is equivalent of the address of 1. Now, why is it that it still does not work?

Because of types (I think that it what you meant). But what are the different things in post 12/13?

2. Originally Posted by Niels_M
Ok, I feel like this thread got de-railed totally. I really appreciate all the input so far, but it does not seem to be answers to my OP.

I still don't feel like I have gotten a clear answer, so if anybody would help, I would appreciate it very much.
They're still discussing your original issue.
I am not 100% sure of what the standard says, but so far as I see, there is simply no implicit conversion from int[][] to int*[].
I believe that the 1D array is simply a special case as it decays to a mere pointer. In the 2D case, it treats the right-hand side as an array (which does not decay).

3. A: The rule (see question 6.3) by which arrays decay into pointers is not applied recursively. (Once the rule has been applied once, the result is a pointer to which the rule no longer applies.) An array of arrays (i.e. a two-dimensional array in C) decays into a pointer to an array, not a pointer to a pointer. Pointers to arrays can be confusing, and must be treated carefully; see also question 6.13.
c-faq

4. Just so I can understand fully what the C-FAQ is telling me, I will restate Bayint Naung's question he posed me:

What is the difference between the following?

intarr + 1
&intarr[0] + 1
&intarr[0][0] + 2

I know the last is the address of the element '3' in the 2D-array intarr[2][2]=((1,2), (3,4)) (it should be curly brackets, I know..). But what are the two others?

Popular pages Recent additions