设为首页 加入收藏

TOP

用函数实测字符串的长度
2014-11-23 21:42:02 来源: 作者: 【 】 浏览:5
Tags:函数 实测 字符串 长度
用函数实测字符串的长度
#include
int GetLen(char * str)
{
int count = 0;
char * p;
p = str;
while(*p!='\0')
{
count ++;
p++;
}
return count;
}
int main()
{
char mystring[20];
scanf("%s",mystring);
int len ;
len = GetLen(mystring);
printf("the len is %d\n",len);
getch();
return 0;
}
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇用函数指针求两个数的最大值 下一篇用指针逆序输出字符串

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: