I still have trouble understanding how to handle initialization of an array when its very large and unmanageable, i am trying to test out memset function to see if that will do the trick.
I have an array of pointers for a 'multidimensional array' ..I need the something that will do this here..without a loop that takes so much time.
size of len1 will be around ~250,000
how can I use memset to place 0's in every spot of this kind of array?Code:int **dp = new int*; for(int i=0;i<2;++i) dp[i] = new int[len1+1]; // Really need a faster solution for this!...250,000*2 loops is no good. for(int i=0;i<2;++i) for(int j=0; j<len1+1;++j) dp[i][j] = 0;
I see this example somewhere..for normal array.
But, it gets complicated with pointer array of pointers...bleh
any ideas? should I be using memset?Code:memset (an_array, 0, sizeof(an_array));
Thanks a ton!