Im trying to have a dynamically allocated array, where everytime the pr_create function is called, the array grows in size by one, and a new variable is assigned to that new space. but whenever i call the pr_browse function, only the most recently entered name is printed. (full source code in link) thanks!
Every time you call pr_create(), you allocate memory for a whole new array You then only set the value of the final first element in the array:
1 2
fn_ar = new string[total_a];
fn_ar[acc_num] = temp_fn;
This means that only the element with index acc_num of the array pointed to by fn_ar will have valid data. Every other element will have an undefined value.
You need to read up on memory scope. Why are you declaring functions and then immediately defining them? That's obnoxious. You are resetting 'acc_num' every time you call this function so you're only ever writing to the first element in the array. You're also not doing anything to copy the old data to the new array.