谁能帮我解释下下面的程序,这是SUNDAY算法的程序段,看不太明白,谢谢! 最好主要的代码行给上注释,中文

char *qsearch(const char *text, int n, const char *patt, int m)
{
// get the length of the text and the pattern, if necessary
if (n < 0)//这里什么意思
n = strlen(text);
if (m < 0)//这里什么意思
m = strlen(patt);
if (m == 0)//这里什么意思
return (char*)text;
// construct delta shift table
int td[128];//这里什么意思
for (int c = 0; c < 128; c++)
td[c] = m + 1;
const char* p;
for (p=patt; *p; p++)
td[*p] = m - (p - patt);
// start searching...
const char *t, *tx = text;
// the main searching loop
while (tx + m <= text + n) {
for (p = patt, t = tx; *p; ++p, ++t) {
if (*p != *t) // found a mismatch
break;
}
if (*p == 0) // Yes! we found it!
return (char*)tx;
tx += td[tx[m]]; // move the pattern by a distance
}
return NULL;
}

#include<stdio.h>
int jiecheng(int);
void main()
{
int m;
printf("请输入一个整数:");
scanf("%d",&m);
printf("%d的阶乘是:%d\n",m,jiecheng(m));
}
int jiecheng(int m)
{
int a;
if(m<=1)
a=1;
else
a=jiecheng(m-1)*m;
return a;
}
所谓程序流程图就是程序被编译执行的过程。等你慢慢了解了程序的运行过程后自然也就明白什么是流程图了。

诸渠瘘顾供韧洪震铎奚余爱柬苈炯战粲毅真负綦
温馨提示:答案为网友推荐,仅供参考