+ 1

explain how to access 2D array element by dereferencing operator?(see code)

C challenge question.accessing 2D array. https://code.sololearn.com/cN8Wb9HNfrsy/?ref=app

14th Dec 2021, 5:23 AM
gaurav kumar
gaurav kumar - avatar
1 Answer
+ 2
The array initialization was missing brackets which could help improve clarity on how the elements of the array is arranged. int arr[ 2 ][ 3 ]={ { 2, 3, 4 }, { 5, 6, 7 } }; *( arr + 1 ) Equals to arr[1] Refers the second row -> { 5, 6, 7 } *( *( arr + 1 ) ) Equals to *( *( arr + 1 ) + 0 ) Equals to arr[1][0] Refers to the first column of second row -> 5
14th Dec 2021, 7:25 AM
Ipang