trying to write function that returns 1 if every letter in “word” appears in “s”. for example: 
containsLetters1("this_is_a_long_string","gas") returns 1
containsLetters1("this_is_a_longstring","gaz") returns 0
containsLetters1("hello","p") returns 0
Can't understand why its not right:
#include <stdio.h>
#include <string.h>
#define MAX_STRING 100
int containsLetters1(char *s, char *word)
{
int j,i, flag;
long len;
len=strlen(word);
for (i=0; i<=len; i++) {
flag=0;
for (j=0; j<MAX_STRING; j++) {
if (word==s) {
flag=1;
word++;
s++;
break;
}
s++;
}
if (flag==0) {
break;
}
}
return flag;
}
int main() {
char string1[MAX_STRING] , string2[MAX_STRING] ;
printf("Enter 2 strings for containsLetters1\n");
scanf ("%s %s", string1, string2);
printf("Return value from containsLetters1 is: %d\n",containsLetters1(string1,string2));
return 0;
scanfcall is unsafe - i can enter string longer that 100 chars and smash your stacks, rather than MAX_STRING. You also lose the original values ofs(andword), so you can't start at the beginning again to match the second character inword.sugar-free, and the string has all those letters, but does not have a hyphen, it fails. Your code also neglects case. Even if the left string has all the lower case letters of the alphabet, likethe quick brown fox jumped over the lazy dogs, but the word contains upper case letters, then the code also fails. If by "letter" you mean "any character other than null, printable or not", you should fix the problem specification.