The variable you're trying to store in progmem needs to be global, it doesn't make sense to try to store a local variable in progmem.
The variable needs to be initialised as part of its definition; you can't define it and then assign values to it separately.
If you want persistent storage which can be modified at runtime, the EEPROM might be a better bet. If using EEPROM, make sure your code doesn't update the EEPROM stored values repeatedly because the storage only supports a limited number of write cycles.
I would like to thank you all, specially to AWOL who showed me the peculiarity of Harvard architecture.
So, I've solved my problem with this piece of code:
#include <avr/pgmspace.h>
prog_char string_0[] PROGMEM = "String 0"; // "String 0" etc are strings to store - change to suit.
prog_char string_1[] PROGMEM = "String 1";
prog_char string_2[] PROGMEM = "String 2"; // "String 0" etc are strings to store - change to suit.
prog_char string_3[] PROGMEM = "String 3";
struct map_t
{
prog_char *a;
prog_char *b;
};
const map_t some[2] PROGMEM = {
{string_0, string_1},
{string_2, string_3}
} ;
void setup () {
Serial.begin(9600);
Serial.println(availableMemory());
for (int i = 0; i < 2; i++){
int N = strlen_P((char*)pgm_read_word(&(some[i].b)));
char buffer[N];
strcpy_P(buffer, (char*)pgm_read_word(&(some[i].a))); // Necessary casts and dereferencing, just copy.
Serial.println( buffer );
strcpy_P(buffer, (char*)pgm_read_word(&(some[i].b))); // Necessary casts and dereferencing, just copy.
Serial.println( buffer );
}
delay( 500 );
}
void loop () {}