文章目录 一、查找子串在母串中的位置 二、一个实现字符串拼接的函数 一、查找子串在母串中的位置 #include<iostream> using namespace std; int SearchIndex(char* str1, char* str2) //返回子串起始位在主串中的下标 { int i, j; for(i=0; i<sizeof(str1); i++) { if(str1[i]==str2[0]) //遍历到的字符与str2的首字符对应上了 for