#include<stdio.h>
#include<stdlib.h>
#include<math.h>
char* prefix(char* haystack_start, char* needle_start)
{
char* haystack = haystack_start;
char* needle = needle_start;
while(*haystack && *needle){
if( *needle++!=*haystack++ ) return NULL; //填空位置
}
if(*needle) return NULL;
return haystack_start;
}
int main()
{
char *f="asdfgh";
char *g="asd";
char *c=prefix(f,g);
printf("%s",c);
return 0;
}