-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, 12 Jan 2004 18:56:41 -0000
"ged.suse"
Structures are global and are as follows:
struct StockItem { int code; char desc[20]; float price; }stock[NUM_OF_ITEMS];
struct BillLine { StockItem stock; float weight; float cost; }bill_line[50]; <snip> /*line 213*/ bill.stock = stock[item]; cout << "Weight: ";
(+(i * 3508)))->BillLine::stock', which is of non-aggregate type ` StockItem[125]'
On Mon, 12 Jan 2004 14:06:09 -0500 (EST)
Trey Gruel
problem you're having is becuase in the full code, you're trying to assign a single StockItem to an array of them without referencing a single array location. the second error has the same cause. you're trying to access the desc value but treating it as a single StockItem, not an array.
I think that Trey's comments are legitimate, but not the solution.
bill.stock is a single instance of a stock item.
I think you might be able to cast this:
bill.stock = *
{ StockItem *stock; float weight; float cost; }bill_line[50];
Then:
bill.stock = &stock[item];
Now, bill.stock will point to the appropriate instance,
Also, I did not check you code, but item must be in the range from 0 >=
item < NUM_ITEMS.
If item == NUM_ITEMS, then you are exceeding the bounds of the array.
But, it appears that your code is really C being compiled with a C++
compiler.
- --
Jerry Feldman