当前位置:网站首页>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.
*/
边栏推荐
- 【21天学习挑战赛】顺序查找
- Tensors - Application Cases
- 小程序 + 电商,玩转新零售
- Deep learning -- CNN clothing image classification, for example, discussed how to evaluate neural network model
- 7. The principle description of LVS load balancing cluster
- Take care of JVM performance optimization (own note version)
- Structure function exercise
- PL/SQL Some Advanced Fundamental
- Converts XML tags to TXT format (voc conversion for yolo convenient training)
- 备份工具pg_dump的使用《postgres》
猜你喜欢
解决错误:npm WARN config global `--global`, `--local` are deprecated
Tensors - Application Cases
JVM笔记
System design. How to design a spike system (full version transfer)
【机器学习】21天挑战赛学习笔记(一)
System design. Seckill system
day13--postman接口测试
深度学习环境配置
About yolo7 and gpu
3000 words, is take you understand machine learning!
随机推荐
如何简化现代电子采购的自动化?
如何打造一篇优秀的简历
OpenGL绘制一个圆锥
SQL query String field less than 10 how to check
go module的介绍与应用
【21天学习挑战赛】图像的旋转问题(二维数组)
C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.4 使声明与定义相匹配
Get the selected content of the radio box
2.15 keil使用电脑端时间日期
你以为border-radius只是圆角吗?【各种角度】
解决问题遇到的问题
2022 software test interview questions The latest ByteDance 50 real interview questions, 15k have been won after brushing, with explanation + Q&A
【21 Days Learning Challenge】Direct Insertion Sort
有趣的 Kotlin 0x0E:DeepRecursiveFunction
7-3 LVS+Keepalived Cluster Description and Deployment
【云原生--Kubernetes】Pod资源管理与探针检测
【评价类模型】Topsis法(优劣解距离法)
Mini program + e-commerce, fun new retail
Converts XML tags to TXT format (voc conversion for yolo convenient training)
flink cdc一启动,源端Oracle那台服务器的CPU就飙升到80%以上,会是啥原因呢?