The strstream class in C++ is specifically designed for reading and writing to an array in memory. It implements stream operations on character arrays stored in memory. Ostream is for output streams only, ifstream is for input file streams, so strstream is the correct answer for in-memory array I/O operations.