char *substring,*string; int same; substring="gram"; string="this program return index of substring"; same=pattern_index(substring, string); if(same) cout<<"子串起始位置: "<<same<<end1; else cout<<"匹配不成功" <<end1;
【参考答案】
int pattern_index(char substr[],char str[]) { ......