Is there a way of copying a string into a new string without knowing the size that the new array has to be at compile time? As far as I am aware, you can’t have variable array lengths in C.
For example:
void myFunction(char *string)
{
char newString[????];
strcopy(newString, string);
}
Yes there is:
This works with any version of C—even back to v6 Unix (1975).