I get a bus error. It's clear my knowledge of arrays is at teh most basic level, but I'm at wit's end. Any help is appreciated.
#include <stdio.h>
#include <string.h>
main(){
char onetoteens[][19] = {"one ", "two ", "three ", "four ", "five ", "six ", "seven ", "eight ", "nine ", "ten ", "eleven ", "twelve ", "thirteen ", "fourteen ", "fifteen ", "sixteen ", "seventeen ", "eighteen ", "nineteen "};
char tys[][9] = {" twenty", " thirty", " forty", " fifty", " sixty", " seventy", " eighty", " ninety"};
char english[50][50];
int num, first, second, third;
printf ("Enter a three digit number: "
scanf ("%d", &num);
third=num%10;
second=num/10%10;
first=num/100;
strcat (english[50], onetoteens[first-1]);
strcat (english[50], tys[second-2]);
strcat (english[50], onetoteens[third-1]);
printf ("%s", english);
/*printf("The number entered is: %shundred%s %s", onetoteens[first-1], tys[second-2], onetoteens[third-1]);*/
}
#include <stdio.h>
#include <string.h>
main(){
char onetoteens[][19] = {"one ", "two ", "three ", "four ", "five ", "six ", "seven ", "eight ", "nine ", "ten ", "eleven ", "twelve ", "thirteen ", "fourteen ", "fifteen ", "sixteen ", "seventeen ", "eighteen ", "nineteen "};
char tys[][9] = {" twenty", " thirty", " forty", " fifty", " sixty", " seventy", " eighty", " ninety"};
char english[50][50];
int num, first, second, third;
printf ("Enter a three digit number: "
scanf ("%d", &num);
third=num%10;
second=num/10%10;
first=num/100;
strcat (english[50], onetoteens[first-1]);
strcat (english[50], tys[second-2]);
strcat (english[50], onetoteens[third-1]);
printf ("%s", english);
/*printf("The number entered is: %shundred%s %s", onetoteens[first-1], tys[second-2], onetoteens[third-1]);*/
}