In my program I am calling a function using a reference to a structure:
struct stringy
{
char* str;
int ct;
}
void set(reference to stringy, c-string[ ])
Inside the function I want to create an array and copy the passed c-string into the new array. Then set ct = to the length of the string and str = the pointer to my new array. I have always been taught to use new with delete but if I do that then I erase what stringy.str is pointing to. Also it is my understanding that any variables created in a called function cease to exist when that called function isn't running, does this apply to new? Will the 'new' array that I am creating automatically disappear when the set() function is not running? Do I use delete at the end of the program?