当前位置:网站首页>C Pitfalls and Defects Chapter 7 Portability Defects 7.6 Memory Location 0
C Pitfalls and Defects Chapter 7 Portability Defects 7.6 Memory Location 0
2022-08-01 21:10:00 【weixin_Guest time】
Memory location 0
The null pointer does not point to any object.Therefore, it is illegal to use a null pointer for any purpose other than assignment or comparison operations.
Strictly speaking, this is not a portability issue: the effects of misusing a null pointer are undefined in all C programs.The easiest way to check for such problems is to move the program to run on a machine that does not allow access to memory location 0.
Reveal how C handles memory address 0:
#include
int main() {
char *p;
p = NULL;
printf("Location 0 contains %d\n", *p);
return 0;
}
边栏推荐
- 2022牛客多校联赛第五场 题解
- Review Set/Map basics with these two hooks
- Realize the superposition display analysis of DWG drawing with CAD in Cesium
- 关于Request复用的那点破事儿。研究明白了,给你汇报一下。
- R语言 pca主成分分析的主要方法
- 30+的女性测试人面试经验分享
- JVM内存结构详解
- C专家编程 前言
- 封装一个管理 url 状态的 hook
- C pitfalls and pitfalls Chapter 7. Portability pitfalls 7.10 Free first, then realloc
猜你喜欢
C语言_联合体共用体引入
An online JVM FullGC made it impossible to sleep all night and completely crashed~
Internet使用的网络协议是什么
网络安全与基础设施安全局(CISA):两国将在网络安全方面扩大合作
漏洞分析丨HEVD-0x6.UninitializedStackVariable[win7x86]
MySQL Syntax Basics
Pytorch框架学习记录8——最大池化的使用
职场如象棋,测试/开发程序员如何突破成长瓶颈期?
Transplant MQTT source code to STM32F407 development board
LeetCode·每日一题·1374.生成每种字符都是奇数个的字符串·模拟
随机推荐
win10版本1803无法升级1903系统如何解决
附录A printf、varargs与stdarg A.1 printf函数族
JS提升:如何中断Promise的链式调用
tiup mirror
C Pitfalls and pitfalls Appendix B Interview with Koenig and Moo
360借条安全专家:陌生微信好友不要轻易加贷款推广多是诈骗
Day33 LeetCode
人工智能可信安全与评测
如何封装 cookie/localStorage/sessionStorage hook?
Hiking, cured my mental internal friction
Classification interface, Taobao classification details API
C陷阱与缺陷 第5章 库函数 5.5 库函数signal
SkiaSharp 之 WPF 自绘 五环弹动球(案例版)
C专家编程 第1章 C:穿越时空的迷雾 1.2 C语言的早期体验
MySQL 中出现的字符编码错误 Incorrect string value: ‘\x\x\x\x‘ for column ‘x‘
R语言 数据的关系探索
How to make the timer not execute when the page is minimized?
C陷阱与缺陷 第8章 建议与答案 8.1 建议
C陷阱与缺陷 第7章 可移植性缺陷 7.7 除法运算时发生的截断
STAHL touch screen repair all-in-one display screen ET-316-TX-TFT common faults