0
Arrays are passed by reference only so pass array name just.
0
//removed errors:
#include <iostream>
using namespace std;
class BookInventory
{
public:
BookInventory(string Books[])
{
}
};
int main()
{
string Books[20]={"Think and Grow Rich","Think like a Monk","As a man thinketh","Eat that frog"};
BookInventory Book(Books);
return 0;
}
0
Actually, an array name [Books] is a pointer itself, it points to the first element address, when you pass (Books) as argument, it is actually passed as &Books[0] so it will pass address of first element so incrementing it will point to next value. . So no need to pass explicitly address of array.. It pass reference of first element of array so changes in array in function, reflect back on original array so it is pass by reference or synonymously pass by address.
if you want use a pinter in function then you can use like :
BookInventory(string *Books)
{
}
//both works same