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

问题描述:

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个回答 分类:综合 2014-11-17

问题解答:

我来补答
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
 
 
展开全文阅读
剩余:2000
下一页:先解十一题