The necessity to memset with '\0', in a toy example
问题 I encountered the following example of using memset in tutorialspoint: (I am not familiar with C.) #include <stdio.h> #include <string.h> int main(){ char src[40]; char dest[100]; memset(dest, '\0', sizeof(dest)); strcpy(src, "This is tutorialspoint.com"); strcpy(dest, src); printf("Final copied string : %s\n", dest); return(0); } I don't get why the memset line is used, as the compile and result are the same when that line is commented. I would like to ask is that line necessary? or is it a