Error msg in PROGMEM

Hi floks
im tring to store times in PROGMEM
but i got this Error : invalid types ‘char[int]’ for array subscript

i want to use variable (CityName) to use it when i change CityCode cityname will change

#include <avr/pgmspace.h> // Bur tamam
#include <EEPROM.h>
const long LONDON[][8] PROGMEM = {
{	1,	1,	539,	700,	1225,	325,	545,	701	},
{	2,	1,	540,	700,	1225,	325,	545,	701	},
{	3,	1,	540,	701,	1226,	326,	546,	702	},
{	4,	1,	540,	701,	1226,	327,	547,	702	},
{	5,	1,	541,	701,	1227,	327,	547,	703	},
{	6,	1,	541,	701,	1227,	328,	548,	704	},
{	7,	1,	541,	702,	1228,	329,	549,	704	},
{	8,	1,	541,	702,	1228,	329,	549,	705	},
{	9,	1,	542,	702,	1229,	330,	550,	706	},
{	10,	1,	542,	702,	1229,	331,	551,	706	},
};
const long NEWYOURK[][8] PROGMEM = {
{	1,	1,	539,	720,	1230,	325,	545,	708	},
{	2,	1,	540,	700,	1225,	345,	545,	701	},
{	3,	1,	540,	701,	1226,	326,	546,	702	},
{	4,	1,	540,	701,	1226,	327,	547,	702	},
{	5,	1,	541,	701,	1227,	327,	547,	703	},
{	6,	1,	541,	701,	1227,	328,	548,	704	},
{	7,	1,	541,	702,	1228,	329,	549,	704	},
{	8,	1,	541,	702,	1228,	329,	549,	705	},
{	9,	1,	542,	702,	1229,	330,	550,	706	},
{	10,	1,	542,	702,	1229,	339,	551,	706	},
};
int CityCode = EEPROM.read(7);
void setup()
{
  
}
void loop() 
{
char CityName;
if (CityCode == 1)
{
CityName = 'LONDON';
}
if (CityCode == 2)
{
CityName = 'NEWYOURK';
}
    for (int r = 0; r <= 11; r++)
  {
    if ((pgm_read_word( & CityName[ r ][ 0 ]) == day) && (pgm_read_word( & CityName[ r ][ 1 ]) == month)) //   <---- Error msg show Here. 
    {
   FA = pgm_read_word( & CityName[ r ][ 2 ] ); 
   SH = pgm_read_word( & CityName[ r ][ 3 ] ); 
   DH = pgm_read_word( & CityName[ r ][ 4 ] ); 
   AS = pgm_read_word( & CityName[ r ][ 5 ] ); 
   MA = pgm_read_word( & CityName[ r ][ 6 ] ); 
   ESH = pgm_read_word( & CityName[ r ][ 7 ] ); 
    }
   }
}
CityName = 'LONDON';

Show us a picture of your keyboard, with the ‘LONDON’ key highlighted.

That's not what I asked for :wink:

CityName is a single character.
It cannot have two dimensions, therefore it cannot have two subscripts.
It also can't hold the six characters LONDON.

Thank you for your explanation.
How i can solve this problem?

You could make your PROGMEM array three dimensional.

and it's NEWYORK

Please provide me a small code Example

const long cities[][iCantBeBotheredToCountEntries][8] PROGMEM

Same Problem :’(

#include <avr/pgmspace.h> 
#include <EEPROM.h>
const long LONDON[][1][8] PROGMEM = {
{	1,	1,	539,	700,	1225,	325,	545,	701	},
{	2,	1,	540,	700,	1225,	325,	545,	701	},
{	3,	1,	540,	701,	1226,	326,	546,	702	},
{	4,	1,	540,	701,	1226,	327,	547,	702	},
{	5,	1,	541,	701,	1227,	327,	547,	703	},
{	6,	1,	541,	701,	1227,	328,	548,	704	},
{	7,	1,	541,	702,	1228,	329,	549,	704	},
{	8,	1,	541,	702,	1228,	329,	549,	705	},
{	9,	1,	542,	702,	1229,	330,	550,	706	},
{	10,	1,	542,	702,	1229,	331,	551,	706	},
};
const long NEWYOURK[][1][8] PROGMEM = {
{	1,	1,	539,	720,	1230,	325,	545,	708	},
{	2,	1,	540,	700,	1225,	345,	545,	701	},
{	3,	1,	540,	701,	1226,	326,	546,	702	},
{	4,	1,	540,	701,	1226,	327,	547,	702	},
{	5,	1,	541,	701,	1227,	327,	547,	703	},
{	6,	1,	541,	701,	1227,	328,	548,	704	},
{	7,	1,	541,	702,	1228,	329,	549,	704	},
{	8,	1,	541,	702,	1228,	329,	549,	705	},
{	9,	1,	542,	702,	1229,	330,	550,	706	},
{	10,	1,	542,	702,	1229,	339,	551,	706	},
};
int CityCode = EEPROM.read(7);
void setup()
{
 
}
void loop()
{
char CityName;
if (CityCode == 1)
{
CityName = 'LONDON';
}
if (CityCode == 2)
{
CityName = 'NEWYOURK';
}
    for (int r = 0; r <= 11; r++)
  {
    if ((pgm_read_word( & CityName[ r ][ 0 ]) == day) && (pgm_read_word( & CityName[ r ][ 1 ]) == month)) //   <---- Error msg show Here.
    {
   FA = pgm_read_word( & CityName[ r ][ 2 ] );
  
#include <avr/pgmspace.h> // Bur tamam
#include <EEPROM.h>
const long LONDON[][8] PROGMEM = {
{	1,	1,	539,	700,	1225,	325,	545,	701	},
{	2,	1,	540,	700,	1225,	325,	545,	701	},
{	3,	1,	540,	701,	1226,	326,	546,	702	},
{	4,	1,	540,	701,	1226,	327,	547,	702	},
{	5,	1,	541,	701,	1227,	327,	547,	703	},
{	6,	1,	541,	701,	1227,	328,	548,	704	},
{	7,	1,	541,	702,	1228,	329,	549,	704	},
{	8,	1,	541,	702,	1228,	329,	549,	705	},
{	9,	1,	542,	702,	1229,	330,	550,	706	},
{	10,	1,	542,	702,	1229,	331,	551,	706	},
};
const long NEWYOURK[][8] PROGMEM = {
{	1,	1,	539,	720,	1230,	325,	545,	708	},
{	2,	1,	540,	700,	1225,	345,	545,	701	},
{	3,	1,	540,	701,	1226,	326,	546,	702	},
{	4,	1,	540,	701,	1226,	327,	547,	702	},
{	5,	1,	541,	701,	1227,	327,	547,	703	},
{	6,	1,	541,	701,	1227,	328,	548,	704	},
{	7,	1,	541,	702,	1228,	329,	549,	704	},
{	8,	1,	541,	702,	1228,	329,	549,	705	},
{	9,	1,	542,	702,	1229,	330,	550,	706	},
{	10,	1,	542,	702,	1229,	339,	551,	706	},
};
int CityCode = EEPROM.read(7);
void setup()
{
 
}
void loop()
{
char CityName;
if (CityCode == 1)
{
CityName = 'LONDON';
}
if (CityCode == 2)
{
CityName = 'NEWYOURK';
}
    for (int r = 0; r <= 11; r++)
  {
    if ((pgm_read_word( & CityName[ r ][ 0 ]) == day) && (pgm_read_word( & CityName[ r ][ 1 ]) == month)) //   <---- Error msg show Here.
    {
   FA = pgm_read_word( & CityName[ r ][ 2 ] );
   SH = pgm_read_word( & CityName[ r ][ 3 ] );
   DH = pgm_read_word( & CityName[ r ][ 4 ] );
   AS = pgm_read_word( & CityName[ r ][ 5 ] );
   MA = pgm_read_word( & CityName[ r ][ 6 ] );
   ESH = pgm_read_word( & CityName[ r ][ 7 ] );
    }
   }
}


    }
   }
}
char CityName = 'NEWYOURK';

is not valid syntax for a string, it must be

char[] CityName = "NEWYOURK";

and it's New York...

Same Problem :cry:

but a different solution to the one outlined.
Re-read my earlier answer, and forget the idea that you can put six characters in a single "char" variable.
Just use the value you read from EEPROM as the first index.

aarg

char CityName = "NEWYORK";

still same problem

Alright, forget also the idea that you can subscript an array with anything other than an integer data type.
By the time the sketch is compiled the name of the array, either LONDON or NEWYORK no longer exists, so trying to refer to it by name (either as a C string or a C multicharacter variable) is utterly pointless.

Have another look at reply 8.

const long CITIES[2][10][8] PROGMEM = {
{
{	1,	1,	539,	700,	1225,	325,	545,	701	},
{	2,	1,	540,	700,	1225,	325,	545,	701	},
{	3,	1,	540,	701,	1226,	326,	546,	702	},
{	4,	1,	540,	701,	1226,	327,	547,	702	},
{	5,	1,	541,	701,	1227,	327,	547,	703	},
{	6,	1,	541,	701,	1227,	328,	548,	704	},
{	7,	1,	541,	702,	1228,	329,	549,	704	},
{	8,	1,	541,	702,	1228,	329,	549,	705	},
{	9,	1,	542,	702,	1229,	330,	550,	706	},
{	10,	1,	542,	702,	1229,	331,	551,	706	}},
{
{	1,	1,	539,	720,	1230,	325,	545,	708	},
{	2,	1,	540,	700,	1225,	345,	545,	701	},
{	3,	1,	540,	701,	1226,	326,	546,	702	},
{	4,	1,	540,	701,	1226,	327,	547,	702	},
{	5,	1,	541,	701,	1227,	327,	547,	703	},
{	6,	1,	541,	701,	1227,	328,	548,	704	},
{	7,	1,	541,	702,	1228,	329,	549,	704	},
{	8,	1,	541,	702,	1228,	329,	549,	705	},
{	9,	1,	542,	702,	1229,	330,	550,	706	},
{	10,
const long LONDON[][1][8] PROGMEM = { ...
   FA = pgm_read_word( & CityName[ r ][ 2 ] );

I think you'll want to use pgm_read_dword() if your numbers are longs. Though I don't see why they're longs.

Looks to me like the "for" loop needs some work too.

Thanks for all

but that issue still no change

Now im using this code but get this Error msg :
CityNames:10: error: cannot convert ‘const long int ()[1][8]’ to 'const char const’ in initialization

#include <avr/pgmspace.h>
const long LONDON[][1][8] PROGMEM = {
{	1,	1,	539,	700,	1225,	325,	545,	701	},
{	2,	1,	540,	700,	1225,	325,	545,	701	},
};
const long NEWYUORK[][1][8] PROGMEM = {
{	3,	1,	540,	701,	1226,	326,	546,	702	},
{	4,	1,	540,	701,	1226,	327,	547,	702	},
};
const char* const CityNames[] PROGMEM = {LONDON, NEWYUORK}; //  <--- Error HIGHLIGHT
char buffer[30];    
void setup()
{
  Serial.begin(9600);
  while(!Serial);
  Serial.println("OK");
}

void loop()
{
 int i = 1; 
    strcpy_P(buffer, (char*)pgm_read_word(&(CityNames[i]))); 
    Serial.println(buffer);
    delay(500);
}

Take a really close look at reply #13.

const long LONDON[][1][8] PROGMEM = {
{	1,	1,	539,	700,	1225,	325,	545,	701	},
{	2,	1,	540,	700,	1225,	325,	545,	701	},
};

You've told the compiler there's a three dimensional array, where the second dimension is a single element, and you've initialised the array with two dimensions.
That's not at all confusing.

Now im using 3 dimintion but still get Error:
error: invalid types ‘const char[int]’ for array subscript

#include <avr/pgmspace.h> // Bur tamam
#include <EEPROM.h>
const long LONDON[10][10][8] PROGMEM = {
{	1,	2,	539,	700,	1225,	325,	545,	701	},
{	2,	3,	540,	700,	1225,	325,	545,	701	},
{	3,	4,	540,	701,	1226,	326,	546,	702	},
{	4,	5,	540,	701,	1226,	327,	547,	702	},
{	5,	6,	541,	701,	1227,	327,	547,	703	},
{	6,	7,	541,	701,	1227,	328,	548,	704	},
{	7,	8,	541,	702,	1228,	329,	549,	704	},
{	8,	10,	541,	702,	1228,	329,	549,	705	},
{	9,	11,	542,	702,	1229,	330,	550,	706	},
{	10,	12,	542,	702,	1229,	331,	551,	706	},
};
const long NEWYUORK[10][10][8] PROGMEM = {
{	1,	2,	555,	720,	1230,	335,	545,	708	},
{	2,	3,	540,	700,	1225,	345,	545,	701	},
{	3,	4,	540,	701,	1226,	326,	546,	702	},
{	4,	5,	540,	701,	1226,	327,	547,	702	},
{	5,	6,	541,	701,	1227,	327,	547,	703	},
{	6,	7,	541,	701,	1227,	328,	548,	704	},
{	7,	8,	541,	702,	1228,	329,	549,	704	},
{	8,	9,	541,	702,	1228,	329,	549,	705	},
{	9,	10,	542,	702,	1229,	330,	550,	706	},
{	10,	11,	542,	702,	1229,	339,	551,	706	},
};
const char* const CityNames[] PROGMEM = {LONDON, NEWYUORK}; //  <--- Error HIGHLIGHT <-------------------------
int CityCode = EEPROM.read(7); // CityCode as index
void setup()
{
 
}
void loop()
{
int FA;
int day = 1;
int month = 2;

    for (int r = 0; r <= 11; r++)
  {
    if ((pgm_read_word( & CityNames[CityCode][r][0]) == day) && (pgm_read_word( & CityNames[CityCode][r][1]) == month)) 
    {
   FA = pgm_read_word( & CityNames[CityCode][r][2] );
    }
   }
}
const long LONDON[10][10][8] PROGMEM = {

You don’t have ten cities, you have two cities.

Uncompiled, untested, from your original post)

#include <avr/pgmspace.h> 
#include <EEPROM.h>
const long CITIES [2][10][8] PROGMEM = {
  {
		{	1,	1,	539,	700,	1225,	325,	545,	701	},
		{	2,	1,	540,	700,	1225,	325,	545,	701	},
		{	3,	1,	540,	701,	1226,	326,	546,	702	},
		{	4,	1,	540,	701,	1226,	327,	547,	702	},
		{	5,	1,	541,	701,	1227,	327,	547,	703	},
		{	6,	1,	541,	701,	1227,	328,	548,	704	},
		{	7,	1,	541,	702,	1228,	329,	549,	704	},
		{	8,	1,	541,	702,	1228,	329,	549,	705	},
		{	9,	1,	542,	702,	1229,	330,	550,	706	},
		{	10,	1,	542,	702,	1229,	331,	551,	706	}
	},
	{
		{	1,	1,	539,	720,	1230,	325,	545,	708	},
		{	2,	1,	540,	700,	1225,	345,	545,	701	},
		{	3,	1,	540,	701,	1226,	326,	546,	702	},
		{	4,	1,	540,	701,	1226,	327,	547,	702	},
		{	5,	1,	541,	701,	1227,	327,	547,	703	},
		{	6,	1,	541,	701,	1227,	328,	548,	704	},
		{	7,	1,	541,	702,	1228,	329,	549,	704	},
		{	8,	1,	541,	702,	1228,	329,	549,	705	},
		{	9,	1,	542,	702,	1229,	330,	550,	706	},
		{	10,	1,	542,	702,	1229,	339,	551,	706	}
	}	
};

int CityCode;

int day, month, FA, SH,DH, AS, MA, ESH;

void setup()
{
  CityCode = EEPROM.read(7);
}

void loop()
{
  char CityName = CityCode - 1;

  for (int r = 0; r < 10; r++)
  {
    if ((pgm_read_word( &CITIES[CityName][r][ 0 ]) == day) && (pgm_read_word( & CITIES [CityName][ r ][ 1 ]) == month))
    {
		   FA = pgm_read_word( & CITIES[CityName][ r ][ 2 ] );
		   SH = pgm_read_word( & CITIES[CityName][ r ][ 3 ] );
		   DH = pgm_read_word( & CITIES[CityName][ r ][ 4 ] );
		   AS = pgm_read_word( & CITIES[CityName][ r ][ 5 ] );
		   MA = pgm_read_word( & CITIES[CityName][ r ][ 6 ] );
		   ESH = pgm_read_word( & CITIES[CityName][ r ][ 7 ] );
    }
  }
}