作业帮 > 综合 > 作业

c语言中关于函数调用的3道题求解

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/16 08:47:48
c语言中关于函数调用的3道题求解
1.Write the function fun,which computes the result of ,and use the main function to call this function for testing.
2.Write the function strrindex (s,t),which returns the position of the rightmost occurrence of t in s,or -1 if there is none.
3.Imitating the function atoi,which can convert the numeric string to an integer?
麻烦各位把代码给我 一定要是能够运行的代码 如果好的话
1. fun计算什么的结果啊 是不是好了
#include
const char* fun()
{
return "Test fun witch return a const-cstring";
}
void main()
{
printf("%s", fun() );
}
2
int strrindex (const char* s, chat t)
{
int len = strlen(s);
while (len)
{
len--;
if (*(s-len) == t)
return len;
}
return -1;
}
3.
int atoi(const char* s)
{
int n=0;
while (*s >= '0' && *s