I have 2 questions..
is it necessary to add a termination character when executing the following commands against a
char *string
?strcpy();
strncpy();
Is it necessary to allocate memory before before doing any operation with the above to function against the
char *string
?
for example..
char *str;
str = malloc(strlen(texttocopy));
strcpy(texttocopy, str); // see the below edit
Please explain.
EDIT : in the above code I inverted the argument. it is just typo i made while asking the question here. The correct way should be
strcpy(str, texttocopy); // :)