I have an array, and I malloc'd memory for it already, how do I set all the slots to spaces?
Code:char **array; array = (char **) malloc blabla for(i = 0;loop){ array[i] = (char *) malloc again.. //HERE// array[i] = {ALL SPACES??} }
I have an array, and I malloc'd memory for it already, how do I set all the slots to spaces?
Code:char **array; array = (char **) malloc blabla for(i = 0;loop){ array[i] = (char *) malloc again.. //HERE// array[i] = {ALL SPACES??} }
will fill size bytes of whatever is pointed to by memory with ' ', which is space.Code:memset(memory, ' ', size)
--
Mats
Last edited by matsp; 09-27-2008 at 04:19 AM.
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.