0
I need help with pointers
So we know that an array is actually a pointer, BUT when I cout the array say it is arr[] when I cout arr the memory location CHANGES EVERY SINGLE TIME like how....it is supposed to be a pointer to the first element in the array which is the address I see when I print arr. So how come does the address of the first element changes rapidly fast as if it is riding a motorcycle inside the memory 😂.
1 Resposta
+ 1
Intermediate Depression
it might change everytime you rerun the program, but what is important is it stays the same while it is running.
int arr[]{2,2,3,4};
cout<<&arr<<endl;
arr[0] = 200;
cout<<&arr<<endl;
arr[0] = 43;
cout<<&arr<<endl;