Need help with multi-dimensional array please

I have initialized an array as shown below. Later in my code I am accessing 3 of the elements but getting unexpected values when I attempt to print them out. I am expecting to see 99, 0, 17 (dec values) from the print statements but I get 1 4 7 instead.

byte freq[10][3] =
{
{0x69,0x00,0x11}, //420
{0x69,0xc0,0x11}, //423
{0x6a,0x80,0x11}, //426
{0x6b,0x40,0x11}, //429
{0x6c,0x00,0x12}, //432
{0x6c,0xc0,0x12}, //435
{0x6d,0x80,0x12}, //438
{0x6e,0x40,0x12}, //441
{0x6f,0x00,0x12}, //444
{0x6f,0xc0,0x12} //447
};

Serial.println("Channel setting");
Serial.print(byte(freq[0,0]));Serial.print(" ");
Serial.print(byte(freq[0,1]));Serial.print(" ");
Serial.print(byte(freq[0,2]));Serial.println(" ");

Try

Serial.print(freq[0][0]);

I don't think there is a need to cast. And the way you cast is wrong.

Serial.print((byte)freq[0][0]);
  Serial.print(byte(freq[0,1]));Serial.print(" ");

Ahh, the comma operator!

In C, a comma is an operator like miltiplication, division, subtraction. It says "evaluate both terms and just use the final value".

So [nobbc]x = foo(), bar(), baz();[/nobbc] will execute foo(), then bar(), then baz(), and it will assign the return value of baz() to x.

This: [nobbc]byte(freq[0,1])[/nobbc] will evaluate [nobbc]0,1[/nobbc] to the numeric value 1. It will then find the memory address of element 1 of the array (the second sub-array of 3 bytes). It will then truncate that to 8 bits long.

So we'd expect your serial.prints to print 3 values, starting somewhere arbitrary and incrementing by 3 each time (potentially wrapping at 256). And that's exactly what you get: 1, 4, 7.

You want
** **[nobbc]byte(freq[0][1])[/nobbc]** **
, and you don't really need that cast to byte.

This translates to "start with the memory adress of the array. Offset 0 element into the array to get the memory address of the first array of 3 bytes. Offset one element1 into that to get the address of the second byte in that array. Then get the byte at that address".

Equivalently:

byte (*step1)[3] = freq; // initial value -  a memory address
step1 += 0;              // increment by 0 * sizeof(*step1) = 0 * 3 bytes
byte *step2 = *step1;    // first de-reference
step2 += 1;              // increment by 1 * sizeof(*step2) = 1 * 1 byte
byte result = *step2;    // second de-reference

tl;dr: to address mutidmensional arrays, you put the indexes each in their own square brackets

** **[nobbc]freq[0][1][/nobbc]** **

sterretje:
I don't think there is a need to cast.

The reason the cast is there is that he was trying to print the value of a pointer to byte, and Serial.print doesn't support that. So the cast was added to make it compile. It compiled, but did something weird.