?? substr.c
字號:
# include <stdio.h>
int find_substr(char* s1, char* s2);
void main()
{
if(find_substr("C is fun", "is") != -1)
printf("Substring is found.\n");
}
/* 定義子函數 */
int find_substr(char* s1, char* s2)
{
register int t;
char *p, *p2;
for(t=0; s1[t]; t++)
{
p = &s1[t];
p2 = s2;
while(*p2 && *p2==*p)
{
p++;
p2++;
}
if(! *p2)
return t;
}
return -1;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -