[Solved] Trouble copying the string using memcpy


The command strcat(a[0],"\0"); is working on strings which are already terminated by \0. Otherwise it doesn’t know where to append the second string. In your case a[0] is not terminated, so the function will induce undefined behavior. You can do the following instead:

a[0][n] = '\0';

(the same is for the rest of a elements)

9

solved Trouble copying the string using memcpy