mrlowalowa:
byte array [26] [26] = {
{0b00101, 0b11000, 0b11010, 0b01100, 0b00010, 0b10010, 0b01110, 0b10000, 0b00100, 0b10111, 0b01101, 0b10100,
0b00111, 0b00110, 0b01111, 0b10110, 0b11101, 0b01010, 0b01000, 0b00011, 0b01001, 0b10001, 0b01011, 0b11001, 0b11011, 0b11100},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26}
};
const char b_array[26] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
Und den Fehler Code den ich dazu bekomme:
Morse_Entschl_ssler_2:16: error: too many initializers for 'const char [26]'
Morse_Entschl_ssler_2.cpp: In function 'byte moersetable(byte)':
Morse_Entschl_ssler_2:72: error: invalid conversion from 'byte*' to 'byte'
Der Code enthält drei Fehler.
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26}
sind 27 Einträge und nicht 26.
const char b_array[26] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
Das sind Zeichenketten und keine einzelnen Zeichen. Du musst es so schreiben:
const char b_array[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
Und zu guter letzt...
byte array [26] [26] = {
definiert ein Array mit 26 x 26 Zeichen. So wäre es richtig:
byte array [2] [26] = {