my program does not compile. It keeps on saying: [ERROR] invalid conversion from 'char' to 'char*' It should be a program that identifies if two strings are an anagram of each other. I used a sorting method but i don't know if it will work. Hope you guys could help me out. P.S I can only use strings and arrays.
int main ()
{
char sString_1[100], sString2[100], store[50];
int j, i;
printf("Enter String 1: ");
gets(sString_1);
printf("\nEnter String 2: ");
gets(sString2);
if (strlen(sString_1) != strlen(sString2))
printf("%s and %s are not anagrams", sString_1, sString2);
else
{
for(i = 0; i < strlen(sString_1); ++i)
{
for (j=i+1 ; j <= strlen(sString_1); ++j)
{
if (strcmp(sString_1[i], sString2[j]) > 0)
{
strcpy(store,sString_1[i]);
strcpy(sString_1[i],sString_1[j]);
strcpy(sString_1[j],store);
}
}
}
for(i = 0; i < strlen(sString2); i++)
{
for (j= i + 1; j <= strlen(sString2); j++)
{
if (strcmp(sString2[i], sString2[j]) >0)
{
strcpy(store,sString2[i]);
strcpy(sString2[i],sString2[j]);
strcpy(sString2[j],store);
}
}
}
if (strcmp(sString_1, sString2) == 0)
printf("ANAGRAM");
else
printf("NOT");
}
}