How do you create a pointer to an array?
std::string string_array[5 /*<-an arbitrary length determined by a function*/];
std::string** array_pointer = &string_array;
I'll compile this on a Windows 7, 64-bit using MinGW version 4.8.1, and get this error:
main.cpp:116:28: error: cannot convert 'std::string (*)[(((sizetype)<anonymous>) + 1)] {aka std::basic_string<char> (*)[(((sizetype)<anonymous>) + 1)]}' to std::string** {aka std::basic_string<char>**}' in initialization
string** array_pointer = &string_array;
From what I can infer from this wall of text, it doesn't seem to want to set array_pointer
equal to the address of string_array
. Yet as I understand from this link this should compile, because an array is essentially a pointer, so I should create a pointer pointer and point it to the address of my other pointer(my array), correct?