I have a function that translates text entered by the user (it also translates numbers) to Morse code, however I do not understand why the array that contains the alphabet in morse code: m [37] [10] is a two-dimensional array? I understand that the 37 is by the amount of letters, numbers and white space, make a total of 37, but why the 10?
Here is my code:
void textoMorse(){
int i,j;
char texto[37] = {
'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', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ' '
};
char m[37][10]={
{".-,"}, {"-...,"}, {"-.-.,"}, {"-..,"}, {".,"}, {"..-.,"},
{"--.,"}, {"....,"}, {"..,"}, {".---,"}, {"-.-,"}, {".-..,"},
{"--,"}, {"-.,"}, {"---,"}, {".--.,"}, {"--.-,"}, {".-.,"},
{"...,"}, {"-,"}, {"..-,"}, {"...-,"}, {".--,"}, {"-..-,"},
{"-.--,"}, {"--..,"}, {".----,"}, {"..---,"}, {"...--,"},
{"....-,"}, {".....,"}, {"-....,"}, {"--...,"}, {"---..,"},
{"---.,"}, {"-----,"}, {"//"}
};
char frase[1000];
gets(frase);
fflush(stdin);
for(i=0; frase!='\0'; i++){
for(j=0; j<37; j++){
if(frase[i] == texto[j]){
printf("%s",m[j]);
}
}
}
}