#include#include using namespace std; int main() { string colors[] = {"Red","Green","Blue","Yellow","Orange"}; string *ptr = begin(colors); while (ptr != end(colors)) { cout << *ptr << " "; ptr++; } return 0; }
#includeIn this example, we create a StringArray called names and use begin() to initialize the pointer in a for loop. We then use the end() function to set the loop limit and print out each name.#include using namespace std; int main() { string names[] = {"John","Doe","Jane","Doe"}; for (string *ptr = begin(names); ptr != end(names); ptr++) { cout << *ptr << " "; } return 0; }