+ 2

What does pointer of pointer do in c++?

8th May 2018, 8:25 PM
CodderNibba
CodderNibba - avatar
4 ответов
+ 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
9th May 2018, 9:19 AM
AZTECCO
AZTECCO - avatar
+ 1
It can represent a 2D array, or store an address of a pointer.
9th May 2018, 3:50 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
0
Do you mean "**"?
8th May 2018, 11:01 PM
Val Gej
0
yeah exactly
9th May 2018, 3:06 AM
CodderNibba
CodderNibba - avatar