从键盘任意输入一个字符串,用指针的方式计算其实际字符个数并打印出来,即不使用字符串处理函数strlen()编程实现strlen的功能。
函数接口:
unsigned int MyStrlen(const char *pStr)
输入格式:
字符串
输出格式:
字符串长度
输入样例:
在这里给出一组输入。例如:
hello world
代码:
#include<stdio.h>
#include
本文介绍如何通过指针操作实现一个名为MyStrlen的函数,用于计算输入字符串的实际字符数,避开C语言标准库中的strlen函数,适合学习底层编程和指针技巧。
从键盘任意输入一个字符串,用指针的方式计算其实际字符个数并打印出来,即不使用字符串处理函数strlen()编程实现strlen的功能。
函数接口:
unsigned int MyStrlen(const char *pStr)
输入格式:
字符串
输出格式:
字符串长度
输入样例:
在这里给出一组输入。例如:
hello world
代码:
#include<stdio.h>
#include
1万+
7270
1544
2891
3914

被折叠的 条评论
为什么被折叠?
