//考察点1:输入参数加const

int Mystrlen(const char *str)

{//考察点2:断言字符串非0

assert(str!=NULL);

int len=0;//考察点3:一定要初始化

while((*str++)!='\0')

{

len++;

}

return len;

}

编程菜鸟的日记-初学尝试编程-编写函数实现strlen功能(总结考察点)的更多相关文章

  1. 编程菜鸟的日记-初学尝试编程-编写函数实现strcat

    #include <iostream>using namespace std;char *mystrcat(const char *str1,const char *str2){ char ...

  2. 编程菜鸟的日记-初学尝试编程-编写函数实现strcmp功能

    #include <iostream>using namespace std;int mystrcmp(const char *str1,const char *str2){ assert ...

  3. 编程菜鸟的日记-初学尝试编程-编写函数实现strcpy功能(总结考察点)

    char *Mystrcpy(char *strDest, const char *strSrc) //考察点1:将源字符串加const,表明为输入参数 {//考察点2:对源地址和目的地址的非0断言 ...

  4. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习9

    #include <iostream> #include <fstream> #include <cstdlib> #include <string> ...

  5. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习8

    #include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using ...

  6. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习7

    #include <iostream> #include <string> #include <cctype> using namespace std; int m ...

  7. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习6

    #include <iostream> #include <string> using namespace std; const int MSIZE=100; struct j ...

  8. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习5

    #include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int ...

  9. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习4

    #include <iostream> using namespace std; const int strsize=30; const int BOPSIZE=5; void showm ...

随机推荐

  1. 【Leetcode | 5】求和问题

    一.1两数之和 二.15三数之和 C++ Soution 1: class Solution { public: vector<vector<int>> threeSum(ve ...

  2. 函数wait和waitpid

    函数wait 一个进程在终止时会关闭所有文件描述符,释放在用户空间释放的内存,但它的PCB还保留着,内核在其中保存一些信息:如果是正常终止时则保存着退出状态,如果是异常终止则保存着导致该进程终止的信号 ...

  3. C语言之冒泡排序、选择排序、折半查询、进制查表

    菜单导航 1.冒泡排序 2.选择排序 3.折半查询 4.进制查表(十进制转二进制.八进制.十六进制) 一.冒泡排序 //1.冒泡排序 /** 一组无序数字,进行从小到大排序 冒泡排序的过程:就是每个循 ...

  4. Python_时间复杂度概念

    时间频度:一个算法中的语句执行次数称为语句频度或时间频度,记为T(n)(T代表次数,n代表问题规模) 时间复杂度:呈现时间频度的变化规律,记为T(n)=O(f(n)) 指数时间:一个问题求解所需的执行 ...

  5. Python题目练习(一)

    1.使用while循环输入 1 2 3 4 5 6  8 9 10 i = 1 while i <=10 : if i != 7: print(i) else: print(' ') i += ...

  6. html5的audio实现高仿微信语音播放效果

    效果图 前台大体呈现效果图如下: 点击就可以播放mp3格式的录音.点击另外一个录音,当前录音停止! 思路 关于播放动画,这个很简单,我们可以用css3的逐帧动画来实现.关于逐帧动画,我之前的文章也写过 ...

  7. get、post的区别

    Get.post请求的区别 前言 不论是get还是post方式,都是属于http协议,只是http的两种不同的传输方式,而http协议是基于TCP传输协议的,所以无论是get还是post,在传输层的意 ...

  8. day19 正则,re模块

    http://www.cnblogs.com/Eva-J/articles/7228075.html  所有常用模块的用法 正则的规则: 在一个字符组里面枚举合法的所有字符,字符组里面的任意一个字符和 ...

  9. POJ 2531-Network Saboteur(dfs)

    题目链接:https://vjudge.net/problem/POJ-2531 最大流-最小割问题: https://wenku.baidu.com/view/54323c030722192e453 ...

  10. Debian 9 中设置网络

    一.对于有线网络,如果默认没有安装图形界面,进入了 multi-user.target中时,是没有使用NetworkManager管理网络的,此时需要手动配置才能上网 首先得到网卡名称:ip addr ...