hi all, I'm new at this so be nice.
Below is a code for converting a given statement in english into morse code. My problem is that it is not printing to screen beyond the first "word".
Can anyone see where the problem might be?
between letters should be one space, between words should be three spaces.
sorry about the formatting but it went all goobly when I copied/pasted
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct{
char morse[6];
char letter;
}morsecode;
int main(){
morsecode trans[36]={
{".-", 65}, {"-...", 66}, {"-.-.", 67}, {"-..", 68}, {".", 69}, {"..-.", 70},
{"--.", 71}, {"....", 72}, {"..", 73}, {".---", 74}, {"-.-", 75}, {".-..", 76},
{"--", 77}, {"-.", 78}, {"---", 79}, {".--.", 80}, {"--.-", 81}, {".-.", 82},
{"...", 83}, {"-", 84}, {"..-", 85}, {"...-", 86}, {".--", 87}, {"-..-", 88},
{"-.--", 89}, {"--..", 90}, {"-----", 48}, {".----", 49}, {"..---", 50},
{"...--", 51}, {"....-", 52}, {".....", 53}, {"-....", 54}, {"--...", 55},
{"---..", 56}, {"----.", 57}
};
char phrase[34] = {"DUDE WHERES THE 1978 GOGGO MOBILE"};
int search, index;
for(index = 0; index <= 33; index++){
for(search = 0; search <= 35; search++){
if(trans[search].letter == phrase[index]){
printf("%s ", trans[search].morse); }else if(phrase[index] == ' '){
printf(" ");
}else{
printf("\nError Char not found!!!\n");
}
}
}
return 0;
}