The type of ipArray[p] is a C++ std::string. Printf is a C function, and does not understand C++ classes; it expects the argument corresponding to a %s to be a const char*.

Try outputting...