题面
定义一个函数 ,返回 在 中最右边出现的位置( 中的第 个字符的位置为 ),找不到时返回-1。
//********** Specification of strrindex**********
int strReverseIndex(char s[],char t[ ]);
/* precondition: NULL
postcondition: return index of t in s from right to left, -1 if none
*/
只需按要求写出函数定义,并使用给定的测试程序测试你所定义函数的正确性。不要改动测试程序。测试正确后,将测试程序和函数定义一起提交。
/***************************************************************/
/* */
/* DON'T MODIFY main function ANYWAY! */
/* */
/***************************************************************/
#include <stdio.h>
int strReverseIndex(char s[],char t[])
/* precondition: NULL
postcondition: return index of t in s from right to left, -1 if none
*/
{
//TODO: your function definition
}
/***************************************************************/
#define N 80
int main()
{
char s[N+1],t[N+1];
scanf("%s%s",s,t);
//********** strReverseIndex is called here ********************
printf("%d\n",strReverseIndex(s,t));
//**************************************************
return 0;
}