#include #include void StringStartsWith(const char *s1, const char *s2, int i) { i = strlen(s2); if(strncmp(s1, s2, i) == 0) { printf("先頭の文字列と一致します。" ); } else { printf("先頭の文字列と一致しません。" ); } } int main(void) { char *s1, *s2; int i; printf("文字列を入力して下さい。:"); scanf("%s", s1); printf("比較する文字列を入力して下さい。:"); scanf("%s", s2); i = strlen(s2); StringStartsWith(s1, s2, i); return 0; }