As the title says,I must build a strend function with pointers.The function will check if the second string appears at the end of the first string and return 1 if it does or 0 if it doesnt.Here is my code,it is not compiling and its giving an non lvalue in assigment error.Any ideas?
#include <stdio.h>
#define MAX 100
int strend (char *s1,char *s2);
int main()
{
char string1[MAX]="Check Mate";
char string2[MAX]="Mate";
printf("The Result is :\n");
printf("%d",strend(string1,string2));
return 0;
}
int strend (char *s1,char *s2)
{
for(;*s1!='\0';s1++)
{ for(;*s2!='\0' && *s1!='\0' && *s1==*s2;s1++,s2++)
;
}
if(*s1='\0' && *s2='\0')
return 1;
else
return 0;
}