当前位置:网站首页>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.
边栏推荐
- 大三,不简单啊!
- 手机办理股票开户安全性高吗?
- DBNN实验进展
- flowable 边界定时器
- What is the difference between WMS warehouse management system and ERP
- Wave picking of WMS warehouse management system module
- A password error occurred when docker downloaded the MySQL image to create a database link
- TDD和自动化测试
- Zadig + sonarqube, ensuring the safety of the development process
- Powerful open source API interface visual management platform Yapi
猜你喜欢

Zadig + sonarqube, ensuring the safety of the development process

k线图基础知识图解——单根K线的含义

Websocket for im instant messaging development: concept, principle and common sense of mistakes

Wechat red envelope cover making tutorial and use guide with link jump

How to analyze the trend chart of London gold market with the moving average

Online sql to htmltable tool

深入虚拟内存(Virtual Memory,VM)

Online text filter less than specified length tool

老家出资,俞敏洪设立两支基金

Basic knowledge diagram of K-line Diagram -- meaning of single K-line
随机推荐
[SSH] login without password
[flutter issues Series title 71] Mutual Conversion between uint8list and Image in flutter
Lecun predicts AgI: big model and reinforcement learning are both ramps! My world model is the new way
Zadig + sonarqube, ensuring the safety of the development process
收藏 | VLOOKUP函数的这些妙用你都知道吗?
[chapter 71 of the flutter problem series] mutual conversion between uint8list and image in flutter
Hit the industry directly | the flying propeller launched the industry's first model selection tool
[sword finger offer] 50 First character that appears only once
Junior, it's not easy!
Understand shell script in one article
Redis+aop+ user defined annotation to realize flow restriction
flowable 边界定时器
Detailed steps for MySQL to recover data through IBD files
Business atlas in super factory
Powerful open source API interface visual management platform Yapi
lock4j--分布式锁中间件--使用/实例
[kotlin] beautiful pop-up box, custom pop-up box (dialog box), extension function, chrysanthemum waiting bar, message prompt box
大三,不简单啊!
[Chapter 2 of word tutorial series] how to set the table on each page to have a header in word
带链接跳转的微信红包封面制作教程和使用指南