阅读下列函数说明及相应代码,在空白处填入相应语句。
[ 函数 1]
函数 palinddrome(char s[]) 的功能是:判断字符串 s 是否为回文字符串,若是,则返回 0 ,否则返回 -1 。若一个字符串顺读和倒读都一样时,称该字符串是回文字符串,例如:“ LEVEL ”是回文字符串,而“ LEVAL ”不是。
Int palindrome (char s[])
{char *pi, *pj;
Pi = s; pj =s + strlen(s) – 1; //*strlen(s) 函数用于求得串 s 的串长
While ( pi < pj && 1 ) {
Pi ++; pi - - ;
}
if ( 2 )return - 1;
else return 0;
}
[ 函数 2]
函数 insert_sort(int a[],int count) 是用直接插入排序法对指定数组的前 count 个元素从小到大排序。
Void insert_sort(int a[], int count)
{ int i, j, t;
for (i=1;i < count;i++){// 控制 a[i] , …a[count-1] 的比较和插入
t = a[i];
j= 3 ;
while (j ≥ 0&&t < a[j]){ // 在有序部分寻找元素 a[i] 的插入位置
4 ;
j - -;
}
5 ;
}
}
