0
Hey guys, i saw this code in a challenge and I can't understand the (*(*(arr+1))) part, I'll be thankful if someone explain it â€
Arr x Pointer problem https://code.sololearn.com/c7OhgQzRadS9/?ref=app
8 Answers
+ 5
its a reference to the first value of the second "row" of data.
if the array is:
{2,3,4,
5,6,7}
and if *(arr) is equal to the entire first row, then *(*(arr)) would be the first value of the first row
+ 3
No problem! And i know its for c, but pointers are pointers. Check this out if you have some questions
https://www.sololearn.com/learning/2933/
+ 1
Slick I'll sure do! Thanks again đđ»
+ 1
Slick --> Your explanation of that output is not a part of that lesson you are pointing to, but it's the same as using this method:
The first element from the second dimension.....
printf("%d", arr[1][0]);
The array is also confusing, because it stands out as the input is in one dimension and not two.
+ 1
Now, I know how that pointer access to multi arrays works...
cout<< (*(*(arr+1)+1));
//The second element from the second dimension
cout<< (*(*(arr)+2));
//The third element from the first dimension
0
The output seems to be the sum of rows and columns in the multi-dimentional array.
0
Quantum Great đ
but can you explain the mechanism of it, just a little bit?
0
Slick thanks That's so Helpful! Thanks alot đ€©đđ»