Originally posted by battoujutsu
Hi, I'm new at programming, and this is my first time doing arrays...i don't know what the problem with this code is. And where should i ask for the user input of the lines?
Neither do we, unless you tell us what you see when you run the program.
Change your loops to:
Code:
printf("Input a line of letters: ");
do
{
ch = getchar();
if(ch>='a'&&ch<='z') a[ch-'a']=1;
if(ch>='A'&&ch<='Z') a[ch-'A']=1;
} while(ch!='\n');
This way the trouble with scanf() won't bite you in the you-know-where.
Code:
int a[26], b[26], i,is_same;
....
for(i=0;i<=26;i++)
a & b are both 26 character arrays and the for loop goes to the 27th character -- a problem. Make the comparison simply i<26
And put the code tags around the code, not a link.