当前位置:网站首页>快速的将结构体各成员清零
快速的将结构体各成员清零
2022-08-03 05:24:00 【langaopeng】
struct AA{
short int a;
long b;
short int c;
long d;
};
struct AA tab[10];
void main()
{
int i;
for(i=0;i<10;i++)
{
tab[i].a = 0;
tab[i].b = 0;
tab[i].c = 0;
tab[i].d = 0;
}
}现在我懂了,,这样做简单的了。。代码的效率也提高了。。。
struct AA{
short int a;
long b;
short int c;
long d;
};
struct AA tab[10];
void clear(unsigned char *pta, int size )
{
while(size>0)
{
*pta++ = 0
size --;
}
}
void main()
{
clear(( unsigned char *)&tab[0],sizeof(tab));
// 将结构体的起始地址强转,把结构体所占的地址分为若干个BYTE空间,再对各个BYTE空间清0。
}这种方法是不是简单多了。。呵呵。。。。
边栏推荐
- 自监督论文阅读笔记Reading and Writing: Discriminative and Generative Modelingfor Self-Supervised Text Recogn
- 交叉熵(第六周)
- 自监督论文阅读笔记 TASK-RELATED SELF-SUPERVISED LEARNING FOR REMOTE SENSING IMAGE CHANGE DETECTION
- Convolutional Nerual Nertwork(CNN)
- 中国磷化铟晶圆行业发展前景与投资规划分析报告2022~2028年
- c#,.net 下载文件 设置断点
- The ` monorepo ` ` hoist ` mechanism lead to the change of the loading configuration file path
- MySQL 慢查询
- 自监督论文阅读笔记 Ship Detection in Sentinel 2 Multi-Spectral Images with Self-Supervised Learning
- 中国柔性制造系统(FMS)市场发展动态及未来趋势预测报告2022~2028年
猜你喜欢
深度学习理论课程第八、九、十章总结

梯度下降、反向传播

Dynamic adjustment subject web system?Look at this one is enough

mysql 客户端SSL错误2026 (HY000)

自监督论文阅读笔记 Incremental-DETR:Incremental Few-Shot Object Detection via Self-Supervised Learning

opencv透视变化

Makefile

Sqli-labs-master shooting range 1-23 customs clearance detailed tutorial (basic)

Playing with Markdown(2) - Extraction and Manipulation of Abstract Syntax Trees

自监督论文阅读笔记 TASK-RELATED SELF-SUPERVISED LEARNING FOR REMOTE SENSING IMAGE CHANGE DETECTION
随机推荐
自监督论文阅读笔记Reading and Writing: Discriminative and Generative Modelingfor Self-Supervised Text Recogn
自监督论文阅读笔记 Self-supervised Label Augmentation via Input Transformations
中国认证认可服务行业“十四五”发展规划及经营模式分析报告2022~2028年
经典论文-ResNet
【第三周】ResNet+ResNeXt
Execute the mysql script file in the docker mysql container and solve the garbled characters
Oracle null 有哪些注意事项【面试题】
NFT租赁提案EIP-5006步入最后审核!让海外大型游戏的链改成为可能
Browser multi-threaded off-screen rendering, compression and packaging scheme
Makefile
自监督论文阅读笔记DisCo: Remedy Self-supervised Learning on Lightweight Models with Distilled Contrastive
arm64麒麟安装paddlehub(国产化)注意事项
Kettle Spoon 安装配置详解
Router-view
new / malloc / delete / free之间的区别
Sentinel初次使用Demo测试
自监督论文阅读笔记 SimCLRV2 Big Self-Supervised Models are Strong Semi-Supervised Learners
Let small program development into ` tailwind jit ` era
嵌入式实验三(代码几乎都要改才能运行)
卷积神经网络入门