View Single Post
Old 02-20-2006, 05:10 AM   #2 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 745
DJMaze is on a distinguished road
Nice but it doesn't always work.
I got my compiler fail a few times if the array is defined outside main.
Instead i had to use vector or alloc()
Code:
int array = new int[10];
// but can't resize it now
array = new int[100]; // error
Code:
array = (int *)malloc(10 * sizeof(int *));
array = (int *)realloc(array, 100 * sizeof(int *));
DJMaze is offline   Reply With Quote