Dynamically allocating an array of pointers

This is much harder than I thought it would be. The goal is to have the size of the array be determined at runtime by the user. The following code makes an array of
3 pointers Arr, and subsequently each of those pointers are going to point to a one dimensional array. However, the choice of 3 is random, as I don't know how many slots would be needed. Arr should be an array of n slots, where n is determined by the user. Any suggestions.

1
2
3
4
int *Arr[3];
	for(int i = 0; i < 3; i++){
		Arr[i] = new int[3];
	}
Last edited on
int **Arr = new int*[ some ];
Topic archived. No new replies allowed.