Pointer to pointer


C

cbaby

What is the most elegant way to allocate memory to pointer to pointer
using 'new'?

I want to make a dynamic array of pointers, basically.
 
Ad

Advertisements

I

Ian Collins

What is the most elegant way to allocate memory to pointer to pointer
using 'new'?

I want to make a dynamic array of pointers, basically.
int** pp = new int*[2];

pp[0] = new int[10];
pp[1] = new int[10];
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

What is the most elegant way to allocate memory to pointer to pointer
using 'new'?

I want to make a dynamic array of pointers, basically.

int** parray = new int*[size];
 
Ad

Advertisements

J

Juha Nieminen

What is the most elegant way to allocate memory to pointer to pointer
using 'new'?

I want to make a dynamic array of pointers, basically.

Regardless of what is the "most elegant" way of creating an array of
pointers with *new*, I think that the most elegant (and safe) way of
creating an array of pointers is to use std::vector instead of new.
 

Top