Problem C: 指针:自定义函数length,调用它计算字符串的长度

Posted chenlong991223

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Problem C: 指针:自定义函数length,调用它计算字符串的长度相关的知识,希望对你有一定的参考价值。

#include<stdio.h>
int length(char*s)
{
    int i,count;
    while(*s!=)
    {
        *(s++);
        count++;
    }
    return count;
 } 
 
 int main()
 {
     char s[80];
     while(gets(s)!=NULL)
     {
         int t;
         t=length(s);
         printf("%d
",t);
     }
     return 0;
 }

 

以上是关于Problem C: 指针:自定义函数length,调用它计算字符串的长度的主要内容,如果未能解决你的问题,请参考以下文章