Is it possible to copy a string using C's strcpy without first assigning memory to a char *character_array?
Basically, is something like this possible:
strcpy(char *my_string, another_string);
where my_string becomes an initialised string with the same length and content as another_string.
strcpynever allocates memory. The destination must be a pointer to enough, writable, validly-allocated memory, and you are responsible for making sure that the destination memory is validly allocated, long enough, and writable.So these are all okay:
But these are not valid: