If I pass a vector by reference and and I push new elements to the vector and it has to dynamically resize the array while I push elements in the function, will the vector now be at a different location? How does the program ensure that it points to the new dynamically allocated location? Is it using a pointer to the pointer that points to the current array memory location which can be modified after resizing to point to a new contiguous memory location under the hood?
void func(vector<int> &vect)
{
vect.push_back(30);
}
int main()
{
vector<int> vect;
func(vect);
}