This doesn't compile as is (static keyword misused).
I would also suggest turning compiler warnings on.
The most alarming part is this:
Code:
Store *d, *e;
*d = getData(size, loopie);
menu(d, loopie);
*e = reData(d,loopie);
menu(e,loopie);
What you are doing here is declaring two uninitialized pointers, then you dereference d to assign a value returned by getData and pass the uninitialized pointer to another function, and repeat the same error.
Instead getData should return a pointer to the block of memory it allocated. reData probably doesn't need to return the pointer because it is just modifying the array contents?
All in all this part should look something like this:
Code:
Store *d;
d = getData(size, loopie);
menu(d, loopie);
reData(d, loopie);
menu(d, loopie);
Other than this error the indentation leaves much to desire and the architecture is weird. When I look at main, I see this:
Code:
int main()
{
greeting();
return 0;
}
So, the only thing this program does is greet the user?
Another major weirdness is this:
Code:
void display(Store p[], int &loopie)
{
//... snip ...
delete [] p;
}
A display function that destroys the data it displays?!
If possible, the function that allocates the memory should also delete it. Assuming, greeting returns the desired size for the array, your main program might look like this:
Code:
int main()
{
//ask user, how many Stores they want
int max_size = Greetings();
//main allocates memory, so we needn't guess which function should deallocate
Store* stores = new Store[max_size];
//fill it up with data
int entry_count = GetData(stores, max_size);
//run menu, which allows user to modify and display the entries
Menu(stores, entry_count);
//main deallocates resources and exits
delete [] stores;
return 0;
}
You'll need to change your function prototypes for that.