+ 4
please help me to find size of array.........
int arrSize = sizeof(arr)/sizeof(arr[0]); //OK it works fine for me,I understood int arrSize = *(&arr + 1) - arr; //I am not able to get it properly As far as I got it, I think (&arr+1) is the address of address which reflects the address of next to whole 'arr'....... dereferencing it will give us back the address of arr end but how? This is all I can understand ulta sidha... please help me to get it.....................
8 Answers
+ 2
Martin Taylor thanks a lot buddy to make it clear to me.........
+ 2
Martin Taylor Looks like its time for me to revisit some pointer arithmetic concepts in order to enter the esoteric club đŹ
0
Infinity bro i am talking about (&arr+1)
Not (arr+1)
0
Infinity bro please describe me how 2nd method provides size of an array???
0
Infinity bro you were wrong ..
arr+1 means memory address of array element at index 1
*(arr +1 ) means arr[1]
0
I never said `arr+1` is equivalent to `*(arr+1)`