you can try using memcpy
________________________________ From: Jimmy Johnson <[email protected]> To: [email protected] Sent: Fri, March 19, 2010 4:56:30 AM Subject: [c-prog] Initialize 2d array quickly? Is there a better way than the for loop to initialize this 2d array? buffer = new double* [width]; for (i = 0; i < width; i++) { buffer [i] = new double [height]; }; // Set z-buffer to background for (i = 0; i < width; i++) { for (j = 0; j < height; j++) { buffer[i][j] = -10000; // smallest(); }; }; It seems to be pretty slow. Thanks, Jimmy J. Johnson [Non-text portions of this message have been removed]
