int arr[]={1, 10, 11, 9, 100}
Line 9:-
int n = sizeof(arr)/sizeof(int);
Line 14:-
auto it = find(arr, arr+n, key);
The variable n that we declare in stack stores int(5/2)=2
or int(5/4)=1.
Then we use it in Line 14, but we wish to traverse array arr from index 0 to the end point
and find key element.
So, n must be equal to the sizeof(arr), right sir!
Not arr+2 or arr+1?
Correct and Explain me if I’m wrong.
Thanks!