sir mujhe "when we subtract two pointers then we get the number of elements in between " ye wali baat samajh mein nahi ayi
Doubt in find function
Pointers hold addresses of elements in the memory. So a pointer pointing to any element of an array will hold an arbitrary number. In an array, elements are stored in continuous memory locations. So lets say the address of an element in the array is 300. Address of next few elements will be 301, 302, 303 and so on.
So this is why when we subtract two pointers, we get the number of elements between them.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.