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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.