Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // in .h file
- struct Product
- {
- int m_price;
- int const * m_availability;
- //.... (more)
- };
- extern const Product product_array[];
- extern const int product_array_nbr;
- // in .cpp file
- const int avail1[] = {1,2,3};
- const int avail2[] = {2, 3, 5, 7, 11, 13};
- const int avail3[] = {42};
- const Product product_array[] =
- {
- {
- 23,
- avail1,
- //....(more)
- },
- {
- 24,
- avail2,
- //....(more)
- },
- //....(more)
- };
- const int product_array_nbr = sizeof(product_array)/sizeof(product_array[0]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement