How do you create this function?

createItem (inv.item[0], "10300", "Nutella", "Ferrero", 10);

How do you declare typ inv.item[0] ? I get the rest are char (Excluding int at the end) but my compiler says invalid conversion from int to int* . (Because I declared item[8] as an int in the struct invType)
Last edited on
Where's the class constructor?
Maybe you should give us the declaration of the class (or struct) inv.

Anyway, here is what I have understood :
inv.item[0] is an int, so inv.item must be an array of integers (int* or int[X] or int[])
"10300", "Nutella" and "Ferrero" are const char * or std::string (it's a matter of taste, by the way I like Nutella)
and 10 is an integer. If you have a problem with your integers, you can use things like (int) 10 or using casts such as reinterpret_cast<int>(10)
Topic archived. No new replies allowed.