+ 2
What does pointer of pointer do in c++?
4 Respostas
+ 13
Dynamic memory improvements.
suppose you want to make your own container class, like a vector or a list, whit add , erase, sorting, etc.. methods..
If you have an array of pointers to manage data
T *data[]= new T[n];
add(T item)
{
// copy all data in a tempdata + add item
//delete data
//remake all the data
}
if you use instead
T* *data[] = new T*[n];
then you can manage memory in a lighter way.
I provide my tests.. hope it helps.
https://code.sololearn.com/cEKyFrZcJHe7/?ref=app
https://code.sololearn.com/cuwoDWJQGImG/?ref=app
https://code.sololearn.com/cqG8b8XZtwc2/?ref=app
+ 1
It can represent a 2D array, or store an address of a pointer.
0
Do you mean "**"?
0
yeah exactly