Store RAM and PROGMEM strings in one variable I want to store a number of strings in an object. Currently I have:

class MyClass {
  int numStrings = 0;
  ??? strings[20];

  public:
    void addString(const char str[]);
    void print();
};

void MyClass::addString(const char str[]) {
  strings[numStrings] = str;
  numStrings++;
}

void MyClass::print() {
  for (int i = 0 ; i &lt; numStrings ; i++) {
    Serial.println(strings[i]);
  }
}


Serial.println() works with strings in RAM and in PROGMEM alike.

Is there a type that I can give to my strings variable that allows me to store both types of strings?

MyClass s;

s.addString("This should work");
s.addString(F("This should work, too"));
Is there a type that I can give to my strings variable that allows me to store both types of strings?


No, but you could tag the pointer or add a vector with type information or ultimately use a class hierarchy (BaseString&lt;-SRAMString, PROMEMString).  

As a pointer is 16-bit (Arduino Uno) and there is limited amount of SRAM it is possible to add a magic number to pointers to determine the address space.  

Obviously the print() member function will have to use the right type and you will also need a new addString for F() strings. Check how F() is defined. 

Cheers!