Siskin
2011-03-28 04:57:05 UTC
_________________________________
struct element{
char letter[15];
int nr_letters;
int freq;
};
struct bag{
int nr_elem;
element elem[50];
};
bag *a[20];
int main()
{
Read_bags(); //calls function Create for each new bag in the array.
bag *result = Union(a, n);
getch();
return 0;
}
_________________________________
Source file 2:
__________________________________
bag* Create() // "a" in here is tot the array "a", it could have been named "temp"... "a" is just a personal preference
{
bag *a;
a = new bag;
a->nr_elem = 0;
return a;
}
bag* Union(bag** a, int n)
{
//code... the problem is that in here the array "a" no longer contains the information it had in function main. (it is empty)
}
_________________________________
So the question is, what em i doing wrong ?