You don't have to do anything special, just string bin[100]; is fine. The default constructor for std::string will be called for each element of the array.
If the array is a member of some class, initialize it in the member initialization list:
struct SomeClass
{
std::string bin[100];
SomeClass() : bin() // You can initialize arrays with () in the mem-init list
{
}
};
*Technically, the default constructor will be called even if you don't add bin() to the mem-init list, but it is good practice (as built-in types will be left uninitialized).
In C++, members of a class are initialized through initialization lists. For example, in the following examples, there is a difference in the code:
// First example
struct MyClass
{
int i;
SomeClass() : i(1)
{
}
};
// Second example
struct MyClass
{
int i;
SomeClass()
{
i = 1;
}
};
In the first example, i is initialized to 1 in the initialization list. In the second example, 1 is assigned to i. You could think of the above code as doing the following:
int i = 1; // First example
int i; // Second example
i = 1;
For a built-in type like int there isn't much difference between the two, however the difference above can be very important in some situations, such as when the member is declared const:
struct SomeClass
{
const int i;
SomeClass()
{
i = 1; // Error!!
}
};
In the above example, the const member must be initialized in the initialization list.