_CP_str_copy makes a copy of a CPSTR. The actual contents of the string are copied rather than just the pointer.


CPSTR * _CP_str_copy(CPSTR * string)


This example assigns the string "Null value" to all the elements of the array a. Note that copies are necessary so that each element can be modified without affecting the others.

CPSTR * s = _CP_mkstr("Null value");
CPSTR * a[20];
int i;
for (i = 0; i < 20; i++)
a[i] = _CP_str_copy(s);