当前位置:网站首页>Count the number of arrays with pointers
Count the number of arrays with pointers
2022-06-28 23:08:00 【51CTO】
Using the array address subtraction to calculate the number of elements of the array
int
my_strlen(
char
*
str)
{
char
*
star
=
str;
char
*
end
=
str;
while (
*
end
!=
'\0')
{
end
++;
}
return
end
-
star;
}
int
main()
{
char
arr[]
=
"bit";
int
len
=
my_strlen(
arr);
printf(
"%d\n",
len);
return
0;
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
边栏推荐
- This simple little function saves 213 hours for our production research team in half a year
- O & M troubleshooting - use hcache plug-in to troubleshoot excessive buffer/cache occupancy
- 运维排查-使用hcache插件排查Buffer/cache占用过高
- Serious internal entanglement in the we media industry: where should the enterprise we media go
- With a monthly salary of 60000 yuan, such people began to be robbed after the Internet "reduced costs and increased efficiency"
- Embedded dynamic Arabic string conversion LCD display string [thanks for Jianguo ambition]
- YuMinHong set up two funds funded by his hometown
- [SSH] login without password
- C語言-單詞分析解析
- The Best of Many Worlds_ Dual Mirror Descent for Online Allocation Problems
猜你喜欢

两栏布局左边图片显示部分由右边内容高度决定

How to solve the problem of desktop without sound

Hit the industry directly | the flying propeller launched the industry's first model selection tool

WMS仓库管理系统模块之波次拣货

在线文本过滤小于指定长度工具

What is the difference between WMS warehouse management system and ERP

FANUC机器人_KAREL编程入门(2)_通用IO信号的使用方法

leetCode-栈类型详解

在QT进行cin(全网最清晰教程)

Linq连表查询
随机推荐
flowable 边界定时器
Qsrand, srand random number generating function in qt5.15 has been discarded
Detailed steps for MySQL to recover data through IBD files
Google Earth Engine(GEE)——利用sentinel-2数据进行农作物提取分析
手机办理股票开户安全性高吗?
Production environment sonarqube installation
Oracle set password complexity and timeout exit function
笔记
leetCode-栈类型详解
Differences among CPU, GPU, TPU and NPU
【kotlin】好看的弹出框、自定义弹出框(对话框)、扩展函数、菊花等待条、消息提示框
超级工厂里的生意图鉴
微搭低代码中实现二维码生成
直击产业落地 | 飞桨重磅推出业界首个模型选型工具
Basic knowledge diagram of K-line Diagram -- meaning of single K-line
Explanation: Luogu p1762 even number /6.21 internal examination T2
frameworks/base/core/res/res/values/symbols.xml:3915: error: no definition for declared symbol解决办法
Implementation of go language plug-in platform
How to solve the problem of desktop without sound
老家出资,俞敏洪设立两支基金