D
divya_rathore_
Consider the dynamic allocation of a 2D array:
int **temp;
temp = new int*[height];
for (y=0; y<height; y++) temp[y] = new int[width];
I have 2 Questions:
[a] Does new initializes memory to 0?
I want to initialize this to some value not necessarily 0. Is it
ok to use 'memset' to this dynamically allocated array?
If yes, what would be the syntax? Would it be:
memset(temp, 0, width*height*sizeof(int));
thanks in advance,
D. Rathore
(remove underscores for email ID)
int **temp;
temp = new int*[height];
for (y=0; y<height; y++) temp[y] = new int[width];
I have 2 Questions:
[a] Does new initializes memory to 0?
I want to initialize this to some value not necessarily 0. Is it
ok to use 'memset' to this dynamically allocated array?
If yes, what would be the syntax? Would it be:
memset(temp, 0, width*height*sizeof(int));
thanks in advance,
D. Rathore
(remove underscores for email ID)