I'm new to programming. I can't find errors in this code. I'm trying to translate some characters to numbers.
The program ask to enter a message, but after I entered the characters nothing show up.
#include <stdio.h>
#define N 100
int main (void)
{
char message[N];
int i;
printf ("Enter a message: ");
for (i=0; i<N; i++){
scanf ("%c", &message[i]);
}
// characters are in the array
for (i=0; i<N; i++){
if (message[i]=='a')
message[i]='4';
if (message[i]=='b')
message[i]='8';
if (message[i]=='e')
message[i]='3';
if (message[i]=='i')
message[i]='1';
if (message[i]=='o')
message[i]='0';
if (message[i]=='s')
message[i]='5';
}
// characters are translated
for (i=0; i<N; i++)
printf ("%c ", message[i]);
// characters are printed
return 0;
}
scanf ("%c", &message[i]);-->scanf (" %c", &message[i]);if(message[i] == '\n') break;