Skip to main content
GameDev.net gamedev.net
🔒 Locked

Using 1D dynamic array to replace 2D array

Started by snooty Sep 4, 2006 at 1:15 AM 0 replies 300+ views
Original Post
snooty
snooty
Hi, If I do the following: /////using a 2D dynamic array directly int **array2D = new int *[10]; for (int i = 0; i < 10; ++i) array2D = new int[10]; ///// vs. /////using a 1D array to replace a 2D array int *array1D = new int[10 * 10]; int **array2D = &array1D ///// Will there be a difference in the way the machine accesses an element in array2D? eg. int c = array2D[5][5];

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.