当前位置:网站首页>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() {
}
边栏推荐
- Cannot change version of project facet Dynamic Web Module to 2.3.
- PyTorch四种常用优化器测试
- sklearn之feature_extraction.text.CountVectorizer / TfidVectorizer
- I2C bus timing explanation
- Togglebutton realizes the effect of switching lights
- 关键字 inline (内联函数)用法解析【C语言】
- Machine learning -- linear regression (sklearn)
- Principle and implementation of MySQL master-slave replication
- Mysql database interview questions
- Kaggle competition two Sigma connect: rental listing inquiries (xgboost)
猜你喜欢
Cannot change version of project facet Dynamic Web Module to 2.3.
Variable star user module
Oppo vooc fast charging circuit and protocol
Amba, ahb, APB, Axi Understanding
Detailed explanation of 5g working principle (explanation & illustration)
程序员老鸟都会搞错的问题 C语言基础 指针和数组
几个关于指针的声明【C语言】
MongoDB
Machine learning -- decision tree (sklearn)
5G工作原理详解(解释&图解)
随机推荐
高通&MTK&麒麟 手机平台USB3.0方案对比
Priority inversion and deadlock
ESP8266通过arduino IED连接巴法云(TCP创客云)
MySQL主从复制的原理以及实现
Correspondence between STM32 model and contex M
Come and walk into the JVM
Kconfig Kbuild
电商数据分析--薪资预测(线性回归)
Funny cartoon: Programmer's logic
Togglebutton realizes the effect of switching lights
ESP8266使用arduino连接阿里云物联网
分布式事务的实现方案
Internet protocol details
Variable parameter principle of C language function: VA_ start、va_ Arg and VA_ end
几个关于指针的声明【C语言】
Yarn installation and use
Machine learning -- decision tree (sklearn)
XML file explanation: what is XML, XML configuration file, XML data file, XML file parsing tutorial
sklearn之feature_extraction.text.CountVectorizer / TfidVectorizer
A possible cause and solution of "stuck" main thread of RT thread