Setting up array struct help for function

receipt takes an array of Items as its first parameter, and an int as a second parameter. The second parameter specifies the number of elements in the array


how would i do this
the struct is items

using cstido
 
void receipt(items, int elements);
 
return_type receipt(class_or_struct_type array[], const unsigned SIZE);
Last edited on
closed account (48T7M4Gy)
There are a variety of ways, this is one.

( As a suggestion I would name the Item object or struct with singular "Item" rather than plural "Items". The array of Item's I would name as shopping_cart[], catalogue[] or inventory[] or item_array[] etc. then say size_inventory, array_size etc )

1
2
3
4
void receipt( Item items[], int elements)
{
    ...
}


1
2
3
4
void receipt( Item shopping_cart[], int no_of_items)
{
    ...
}
Last edited on
Topic archived. No new replies allowed.