Q:

Print array of chars by F() makro

To reduce the usage of SRAM on my Arduino I'd like to print some text via the F() makro:
void setup() {
  char text[] = "i am just text";
  if(Serial) {
    Serial.println(F(text));
  }
}

But this throws the following error
C:\Temp\Software\arduino-1.8.10\hardware\arduino\avr\cores\arduino/WString.h:38:74:
error: initializer fails to determine size of '__c'

 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper*>(PSTR(string_literal)))
C:\Temp\Software\arduino-1.8.10\hardware\arduino\avr\cores\arduino/WString.h:38:74:
error: array must be initialized with a brace-enclosed initializer

 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper*>(PSTR(string_literal)))

But I don't really understand how to fix this. Could someone please help me to Serial.println() the text variable via F()?

A:

In your example, text is a mutable char[]. Moving that to flash would be problematic. Changing the mutable in runtime, text[0] = 'I';, would not work as promised. Use the macro with a const char* instead - and do it around the string literal you want flashed.
Try:
auto text = F("i am just text");
// or: auto text = FPSTR("i am just text");
// or: static const char text[] PROGMEM = "i am just a text";

Serial.println(text);

When passing it to a function, you could add an overload for const __FlashStringHelper* (like Print and Println has):
void debug(const __FlashStringHelper *txt) {
    Serial.println(txt);
}
...
debug(text);

Disclamer: Untested

