当前位置:网站首页>快速的将结构体各成员清零
快速的将结构体各成员清零
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。
}这种方法是不是简单多了。。呵呵。。。。
边栏推荐
- 中国认证认可服务行业“十四五”发展规划及经营模式分析报告2022~2028年
- cmdline -[command line,__fdt_pointer,initial_boot_params] boot_command_line 获取
- 自监督论文阅读笔记DisCo: Remedy Self-supervised Learning on Lightweight Models with Distilled Contrastive
- 【DC-2 Range Penetration】
- 磁盘空间管理
- MySQL 排序
- 中国水产养殖行业市场投资分析及未来风险预测报告2022~2028年
- ARMv8 架构----armv8 类别
- 神经网络基础
- 梯度下降、反向传播
猜你喜欢

自监督论文阅读笔记Reading and Writing: Discriminative and Generative Modelingfor Self-Supervised Text Recogn

Qlik Sense 赋值详解(Set、Let)

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

【第三周】ResNet+ResNeXt

自监督论文阅读笔记 Self-Supervised Deep Learning for Vehicle Detection in High-Resolution Satellite Imagery

边缘辅助无人机网络的分层联邦学习

自监督论文阅读笔记 DenseCL:Dense Contrastive Learning for Self-Supervised Visual Pre-Training

【DC-5 Range Penetration】

自监督论文阅读笔记SELF-SUPERVISED SPECTRAL MATCHING NETWORK FOR HYPERSPECTRAL TARGET DETECTION

Execute the mysql script file in the docker mysql container and solve the garbled characters
随机推荐
Qlik Sense 判空详解(IsNull)
自监督论文阅读笔记: MoCoV2使用动量对比学习改进基线
动漫:海贼王女
边缘辅助无人机网络的分层联邦学习
自监督论文阅读笔记 Self-Supervised Visual Representation Learning with Semantic Grouping
Invalid signature file digest for Manifest main attributes解决方法
spark sql 报错 Can‘t zip RDDs with unequal numbers of partitions
对象の使用
enum和enum class的区别
进程间通信IPC - 信号量
Leetcode刷题——128. 最长连续序列
神经网络基础
经典论文-ResNet
自我监督学习和BERT模型
MMU 介绍-[TBL/page table work]
中国生活服务O2O行业发展现状与市场规模预测报告2022~2028年
中国食品微生物检测行业深度监测及投资战略规划建议报告2022~2028年
Qlik Sense 赋值详解(Set、Let)
中国磷化铟晶圆行业发展前景与投资规划分析报告2022~2028年
二叉树常见的问题和解决思路