troubleshooting Question

Fast Initialisation of array

Avatar of danlarkin
danlarkin asked on
C++
4 Comments1 Solution883 ViewsLast Modified:
All,

I'd like to efficiently initialise a large 2D array, which has been defined as follows:

double **a2d_array = new double*[Height];
     for(i = 0; i < new_Height; i++)
       merging_mask_array[i] = new double[Width];

(height & width both greater than 100)

I want to avoid a simplistic 2 level "for" loop and initialising each array element, I tried using memset, but can't seem to get it right? So...

1. Firstly, will memset even speed up execution?
2. How do I use memset for my array?
3. Any other general comments welcome

thanks in advance

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros