Warning about JOlesen's solution: size_of_temp depends on the declaration of temp. If temp is declared as an array, it will work
char temp[MAX];
memset (temp, 0, sizeof (temp));
A common mistake is if it is dynamically allocated. You have to use the size allocated otherwise it will just nullify sizeof(ptr) which, on my compiler is 4.
char* ptr;
ptr = (char*) malloc (MAX);
memset (temp, 0, MAX);