当前位置:网站首页>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.
*/
边栏推荐
- How to simplify the automation of modern e-procurement?
- if,case,for,while
- C Expert Programming Chapter 5 Thinking about Linking 5.1 Libraries, Linking and Loading
- 某母婴小程序加密参数解密
- Enterprise live broadcast is on the rise: Witnessing focused products, micro-like embracing ecology
- C专家编程 第5章 对链接的思考 5.2 动态链接的优点
- 解决问题遇到的问题
- Cache pool of unity framework
- mysql索引笔记
- [21 Days Learning Challenge] Image rotation problem (two-dimensional array)
猜你喜欢

7. The principle description of LVS load balancing cluster

Deep learning -- CNN clothing image classification, for example, discussed how to evaluate neural network model

Explain detailed explanation and practice

系统设计.秒杀系统

7-2 LVS+DR概述与部署

10 Convolutional Neural Networks for Deep Learning 3

小程序 + 电商,玩转新零售

七夕节,我用代码制作了表白信封

day13--postman接口测试

JVM笔记
随机推荐
C专家编程 第5章 对链接的思考 5.2 动态链接的优点
21 days learning challenge 】 【 sequential search
System design. How to design a spike system (full version transfer)
[C language advanced] program environment and preprocessing
2022软件测试面试题 最新字节跳动50道真题面试题 刷完已拿下15k 附讲解+答疑
看DevExpress丰富图表样式,如何为基金公司业务创新赋能
Introduction and application of go module
C Expert Programming Chapter 4 The Shocking Fact: Arrays and pointers are not the same 4.4 Matching declarations to definitions
Mobile payment online and offline payment scenarios
C Expert Programming Chapter 5 Thinking about Chaining 5.6 Take it easy --- see who's talking: take the Turning quiz
7-3 LVS+Keepalived Cluster Description and Deployment
How to dynamically add script dependent scripts
3000字,一文带你搞懂机器学习!
QT 如何识别文件的编码格式
Enterprise live broadcast is on the rise: Witnessing focused products, micro-like embracing ecology
深度学习21天——准备(环境配置)
Simple operation of the file system
How to open a CITIC Securities online account?is it safe?
leetcode 12. Integer to Roman numeral
mysql索引笔记