Assigning string values to a 2D array, error
Can someone explain what is wrong with this assignment of string values to a 2D array? I don't get it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <iostream>
#include <set>
#include <string>
#include <iterator>
#include <vector>
using namespace std;
int main()
{
std::string array[3][3];
array[0][0] = { {"hello", "world"} };
exit(0);
}
|
The line is meaningless in C++. Were you trying to do this:
1 2
|
array[0][0] = "hello";
array[0][1] = "hello";
|
this:
1 2
|
array[0][0] = "hello";
array[1][0] = "hello";
|
or something else entirely?
Thanks!
Topic archived. No new replies allowed.