当前位置:网站首页>[Basic] Pointer in C
[Basic] Pointer in C
2022-07-22 10:20:00 【Naux334】
What is a pointer?
Pointer is a kind of data structure, just like int, char etc., it can let code blocks in different place share a same memory. It can also make some complicate opreation possible, such as linked list.
How do we define a pointer?
Just like define a variable, if you want to define a pointer, you just need to add a * before the variable name.
//Define a integer variable
int a;
//Define a integer pointer variable
int * a;
The code on the second line save the value of a variable, but the code on the fifth line save the address of a variable.
Different kinds of pointer
There are four kinds of pointer:
1. a non-constant pointer to non-constant data
2. a constant pointer to non-constant data
3. a non-constant pointer to constant data
4. a constant pointer to constant data
int * ptr = &x
const int * ptr = &x
int *const ptr = &x
const int *const ptr = &x;
边栏推荐
- 简单弄懂Saas是什么? Saas与传统软件有什么区别?
- 上门预约程序公众号模块 完美版
- 嵌入式总线与通信
- Execution failed for task ‘:app:kaptDevDebugKotlin‘.
- Emqx v4.4.5 Publishing: new exclusive subscriptions and mqtt 5.0 publishing attribute support
- [gestionnaire de projet du système d'information] chapitre IV Structure globale des connaissances en gestion
- d是矩形.
- Qt Creator 8发布
- Using tutorial 1- create X20 project and light LED lights
- < 3> Use of comparator
猜你喜欢
openEuler志高远,开源汇智创未来 | 2022开放原子全球开源峰会 openEuler 分论坛即将开幕
Why are there career bottlenecks for test / development programmers? It seems that everything has changed
Don't step on the "hidden rules" of those testers in the interview
What is cloud rendering? How fast is the rendering speed? Yiwen tells you
Différences entre les liens durs et les liens souples de rhcsa, interprétation des répertoires de premier niveau, redirection, création de fichiers et de répertoires, suppression de fichiers et de rép
Ingress
The difference between rhcsa hard link and soft link, the interpretation of first-class directory, redirection, creating files and directories, deleting files and directories, the use of CP command, t
2022开源PHP留言反馈管理系统 v2.0
Rhcsa compression also includes decompression, tar archive command, file upload and download, variables in sehll, command alias, and command history
RHCSA 简单命令的使用(ls、date、timedatectl、file、stat),文件类型
随机推荐
Microgrid scheduling based on Kalman filter (matlab code implementation)
Qt Creator 8发布
梨花带雨音乐播放器3.91源码开源(网站添加背景音乐)
openEuler志高远,开源汇智创未来 | 2022开放原子全球开源峰会 openEuler 分论坛即将开幕
std::thread 与类对象结合
Recommend the source code of the finished live broadcast, and set the system date, time and time zone
Set implementation class
[interview: concurrent Article 20: multithreading: multiple locks]
d编译时扩展ctfe
Use cpolar to build a business website (3)
如何在OneFlow中新增算子
洗衣店小程序源码-增加对接第三方跑腿
Using tutorial 1- create X20 project and light LED lights
In only 3 hours, how to use AI to do scene mapping and complete scene production? AI creation workflow exploration
el-table-column嵌套el-table-column ,多级表头横向滚动的bug
Différences entre les liens durs et les liens souples de rhcsa, interprétation des répertoires de premier niveau, redirection, création de fichiers et de répertoires, suppression de fichiers et de rép
2022百度世界大会收官 希壤元宇宙露天巨幕&定制会场首秀
When the easycvr platform cascades, there is an error prompt. What is the reason why the port is unreachable?
集合(Properties)
对WEB标准以及w3c的理解与认识?