There may be other errors too but one is in the function
fin()
which does not always return a value:
int fin(char c,char a[])
{
int i;
for(i=0;i<26;i++)
{
if(c==a[i])
return i;
}
return -1;
}
Your code would return a random value when no match has been found. The compiler should throw a warning here that not all pathes return a value. If not, you should compile with a higher warning level (-W option with most compilers).
Another error is that the variable
temp1
is not initialised but may be used before a value is assigned. This should also throw a compiler warning.