 <p>If you want to treat this as a 1d array, you must declare it as so:</p> <pre><code>void data(int i,int arr[],int size) { </code></pre> <p>Or:</p> <pre><code>void data(int i,int *arr,int size) { </code></pre> <p>The reason is that otherwise, <code>arr[i]</code> is interpreted as an array of 2 integers, which decays into a pointer to the first element (and that's the address that is printed).</p> <p>Declaring it as a 1-dimensional array will make sure that <code>arr[i]</code> is seen as an <code>int</code>.</p> <p>Note that whoever calls this function cannot pass a 2D array anymore, or, put another way, cannot make that obvious to the compiler. Instead, you have to pass it a pointer to the first element, as in:</p> <pre><code>data(0, &amp;arr[0][0], 4); </code></pre> <p>Or, equivalently:</p> <pre><code>data(0, arr[0], 4); </code></pre> <p>This just affects the first call, the recursive call is correct, of course.</p> <p>In other words, the code should work, you just need to change the declaration of the parameter <code>arr</code></p>