当前位置:网站首页>Arduino gets the length of the array
Arduino gets the length of the array
2022-07-06 12:04:00 【A geek is as deep as the sea】
hypothesis , Currently, there is such an array
String str[]={
"ddd","ddd","dsgsd","fdsf","oooo"};
Use sizeof() function
sizeof(str) Is the total byte length of the array ,
sizeof(str[0]) Is to get the byte length of one bit in the array .
Use total byte length / One byte length .
The result is . Length of array .
Sample code
String str[5]={
"ddd","ddd","dsgsd","fdsf","oooo"};
int num;
void setup() {
Serial.begin(9600);
num=sizeof(str) /sizeof(str[0]);
Serial.print(" The length of the array :");
Serial.print(num);
}
void loop() {
}
边栏推荐
- Machine learning -- decision tree (sklearn)
- AMBA、AHB、APB、AXI的理解
- 使用LinkedHashMap实现一个LRU算法的缓存
- C语言回调函数【C语言】
- ESP learning problem record
- Selective sorting and bubble sorting [C language]
- 树莓派 轻触开关 按键使用
- ToggleButton实现一个开关灯的效果
- Fashion-Gen: The Generative Fashion Dataset and Challenge 论文解读&数据集介绍
- Reno7 60W super flash charging architecture
猜你喜欢
E-commerce data analysis -- User Behavior Analysis
IOT system framework learning
锂电池基础知识
Detailed explanation of 5g working principle (explanation & illustration)
FTP file upload file implementation, regularly scan folders to upload files in the specified format to the server, C language to realize FTP file upload details and code case implementation
ES6语法总结--下篇(进阶篇 ES6~ES11)
Principle and implementation of MySQL master-slave replication
Basic use of pytest
RT thread API reference manual
ES6语法总结--上篇(基础篇)
随机推荐
C语言回调函数【C语言】
Cannot change version of project facet Dynamic Web Module to 2.3.
uCOS-III 的特点、任务状态、启动
sklearn之feature_extraction.text.CountVectorizer / TfidVectorizer
JS array + array method reconstruction
Nodejs connect mysql
Programmers can make mistakes. Basic pointers and arrays of C language
imgcat使用心得
RuntimeError: cuDNN error: CUDNN_ STATUS_ NOT_ INITIALIZED
Word typesetting (subtotal)
5G工作原理详解(解释&图解)
荣耀Magic 3Pro 充电架构分析
Apprentissage automatique - - régression linéaire (sklearn)
Pytorch-温度预测
Machine learning -- linear regression (sklearn)
Variable star user module
【ESP32学习-2】esp32地址映射
Detailed explanation of express framework
高通&MTK&麒麟 手机平台USB3.0方案对比
RT-Thread的main线程“卡死”的一种可能原因及解决方案