当前位置:网站首页>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
- Jenkins export and import Job Pipeline
- C Expert Programming Chapter 4 The Shocking Fact: Arrays and pointers are not the same 4.4 Matching declarations to definitions
- unity框架之缓存池
- 7.LVS负载均衡群集之原理叙述
- 2022年软件测试——精选金融银行面试真题
- 7-2 LVS+DR Overview and Deployment
- Explain详解与实践
- Interesting Kotlin 0x0E: DeepRecursiveFunction
- C专家编程 第5章 对链接的思考 5.3 函数库链接的5个特殊秘密
猜你喜欢
随机推荐
附加:对于“与数据表对应的实体类“,【面对MongoDB时,使用的@Id等注解】和【以前面对MySQL时,使用的@Id等注解】,是不同的;
[Ryerson emotional speaking/singing audiovisual dataset (RAVDESS)]
7-3 LVS+Keepalived Cluster Description and Deployment
7-3 LVS+Keepalived集群叙述与部署
商城App开发都有哪些功能呢
21 days learning challenge 】 【 sequential search
Will the 2023 PMP exam use the new version of the textbook?Reply is here!
redis中常见的面试题
XSS related knowledge points
结构体指针知识要点总结
el-Select 选择器 底部固定
The 2022 PMP exam has been delayed, should we be happy or worried?
杭电多校-Slipper-(树图转化+虚点建图)
px、em、rem的区别
Explain详解与实践
C Expert Programming Chapter 5 Thinking about Linking 5.1 Libraries, Linking and Loading
C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.1 数组并非指针
C专家编程 第5章 对链接的思考 5.2 动态链接的优点
【21 Days Learning Challenge】Direct Insertion Sort
C专家编程 第5章 对链接的思考 5.1 函数库、链接和载入






![The video of machine learning to learn [update]](/img/e7/c9a17b4816ce8d4b0787c451520ac3.png)


