当前位置:网站首页>C Expert Programming Chapter 4 The Shocking Fact: Arrays and pointers are not the same 4.2 Why does my code not work
C Expert Programming Chapter 4 The Shocking Fact: Arrays and pointers are not the same 4.2 Why does my code not work
2022-08-04 04:59:00 【weixin_Guest time】
/*Shocking fact: arrays and pointers are not the same*/
/*4.1 Arrays are not pointers*/
/*x is pointer point to type int*/
extern int *x;
/*y is an array of elements is type int, the length is not certain. It's storage by definited in somewhere.*/
extern int y[];
/*Why is my code not working*/
/*Type mismatch*/
//File 1:
int mango[100];
//File 2:
extern int *mango;
...
/*Some code that references mango[i]*/
/*Type mismatch*/
//File 1:
int guava;
//File 2:
extern float guava;
/*A reference to an array can always be written as a reference to a pointer, and there really is a context where pointers and arrays are exactly the same
*Unfortunately, this is just a very common use of arrays, not in all cases,
* including the completely wrong "array definition is equivalent to an external declaration of a pointer" above.
*/
边栏推荐
- 有趣的 Kotlin 0x0E:DeepRecursiveFunction
- How to keep the source code confidential in the development under the burning scenario
- [SemiDrive source code analysis] [MailBox inter-core communication] 47 - Analysis of RPMSG_IPCC_RPC mode limit size of single transmission and limit bandwidth test
- 2003. 每棵子树内缺失的最小基因值 DFS
- Uni-app 小程序 App 的广告变现之路:全屏视频广告
- SQL interview Questions
- 信息学奥赛一本通 1312:【例3.4】昆虫繁殖
- el-Select 选择器 底部固定
- Shocked, 99.9% of the students didn't really understand the immutability of strings
- 深度学习环境配置
猜你喜欢
随机推荐
[Ryerson emotional speaking/singing audiovisual dataset (RAVDESS)]
数据治理平台项目总结和分析
转:管理是对可能性的热爱,管理者要有闯进未知的勇气
XSS related knowledge points
drools from download to postman request success
2022年PMP考试延迟了,该喜该忧?
C Expert Programming Chapter 4 The Shocking Fact: Arrays and pointers are not the same 4.4 Matching declarations to definitions
如何简化现代电子采购的自动化?
How to simplify the automation of modern e-procurement?
10 Convolutional Neural Networks for Deep Learning 3
Chapter 5 C programming expert thinking 5.4 alert Interpositioning of links
【21天学习挑战赛】图像的旋转问题(二维数组)
leetcode 12. Integer to Roman numeral
Enterprise live broadcast is on the rise: Witnessing focused products, micro-like embracing ecology
SQL query String field less than 10 how to check
redis中常见的面试题
7-1 LVS+NAT 负载均衡群集,NAT模式部署
【流程图】
C Expert Programming Chapter 5 Thinking about Linking 5.1 Libraries, Linking and Loading
Learn iframes and use them to solve cross-domain problems









