strlen函数
来源:互联网 发布:网络视频编解码器 编辑:程序博客网 时间:2024/05/22 04:59
寻找一种更好的算法比改良一种差劲的算法更有效率。
#include <stddef.h> // size_t#define MAXLEN 100#include <stdio.h>size_t strlen (char const *string) { int length; for (length = 0; *string++ != '\0'; ) { // *string++, ++后返回前一个位置,然后*取内容 length += 1; } return length;}int main () { char s1[MAXLEN], s2[MAXLEN]; printf("> s1\ns2\n> "); scanf("%s\n%s", s1, s2); if (strlen(s1) > strlen(s2)) { // 不可用减法比较大小 printf("s1 > s2\n"); } else { printf("s1 < s2\n"); } return 0;}
0 0
- strlen函数
- strlen函数
- strlen() 函数
- strlen() 函数
- strlen函数
- strlen函数
- strlen函数
- strlen函数
- strlen函数
- strlen函数
- strlen函数
- strlen函数
- strlen函数 辨析
- 字符串函数strlen
- 微软strlen函数实现
- 实现strlen()函数
- strlen函数的实现
- strlen函数的实现
- 第十一周 判断三角形
- map的遍历
- 该错误的解决办法:Incorrect string value: '\xF0\x9F...' for column 'XXX' at row 1
- 开关中断与cpsid/cpsie指令
- 脚本 make
- strlen函数
- IOS-WKWebView的使用以及Cookie的处理
- 转载别人的面试总结,学习
- git使用问题-解决方法 备忘
- 静态库和动态库详解
- 机械键盘测试——《万历十五年》2
- 趣味取小数
- 查询数据库重复记录方法
- 两个springboot项目如何部署在同一个服务上,two spring boot applications deploy in same server