当前位置:网站首页>关于memset赋值的探讨
关于memset赋值的探讨
2022-07-05 14:01:00 【蜡笔小金QAQ】
memset赋值
尽量用0x3f3f3f3f赋值,这样memset赋值结果和“=”赋值号效果相同,不会出现数字对不上。
0x7fffffff同理(7个f)
这是运行代码
可以看到对于memset,这四种方法是等效的。
#include <bits/stdc++.h>
using namespace std;
int a[100];
int main()
{
memset(a, 0x3f, sizeof(a));
cout << a[0] << endl;
memset(a, 0x3f3f, sizeof(a));
cout << a[0] << endl;
memset(a, 0x3f3f3f, sizeof(a));
cout << a[0] << endl;
memset(a, 0x3f3f3f3f, sizeof(a));
cout << a[0] << endl;
cout << 0x3f << endl;
cout << 0x3f3f << endl;
cout << 0x3f3f3f << endl;
cout << 0x3f3f3f3f << endl;
return 0;
}
运行结果:
1061109567
1061109567
1061109567
1061109567
63
16191
4144959
1061109567
边栏推荐
- 03_Solr之dataimport
- Brief introduction to revolutionary neural networks
- Redis6 data type and operation summary
- Liste des liens (simple)
- Wechat app payment callback processing method PHP logging method, notes. 2020/5/26
- Elk enterprise log analysis system
- [cloud resources] what software is good for cloud resource security management? Why?
- [js] basic syntax - for loop
- -Web direction attack and defense world
- SSH免密码登录详解
猜你喜欢

瑞能实业IPO被终止:年营收4.47亿 曾拟募资3.76亿

Rk3566 add LED

These 18 websites can make your page background cool

国富氢能冲刺科创板:拟募资20亿 应收账款3.6亿超营收

IP packet header analysis and static routing

Those things I didn't know until I took the postgraduate entrance examination

upload (1-6)
Jetpack Compose入门到精通

laravel-dompdf导出pdf,中文乱码问题解决
![[South China University of technology] information sharing of postgraduate entrance examination and re examination](/img/a8/41e62a7a8d0a2e901e06c751c30291.jpg)
[South China University of technology] information sharing of postgraduate entrance examination and re examination
随机推荐
Login interface code
Linux下mysql数据库安装教程
Deep copy is hard
These 18 websites can make your page background cool
Scientific running robot pancakeswap clip robot latest detailed tutorial
Introduction to Chapter 8 proof problem of njupt "Xin'an numeral base"
Pancake Bulldog robot V2 (code optimized)
OSI and tcp/ip protocol cluster
Ordering system based on wechat applet
基于 TiDB 场景式技术架构过程 - 理论篇
ELK 企业级日志分析系统
昆仑太科冲刺科创板:年营收1.3亿拟募资5亿 电科太极持股40%
鏈錶(簡單)
Request + BS4 crawl Netease cloud music popular comments
Primary code audit [no dolls (modification)] assessment
TDengine 社区问题双周精选 | 第三期
UE source code reading [1]--- starting with problems delayed rendering in UE
如何将 DevSecOps 引入企业?
Liar report query collection network PHP source code
Attack and defense world web WP