当前位置:网站首页>Pointer initialization
Pointer initialization
2022-07-02 08:25:00 【kq1983】
initialization
Pointer initialization : Address of a variable Memory address Or string constants perhaps NULL
Address of a variable
int i= 10;
int *p2 = &i; // Statement 1 A pointer to the p2, And directly initialize it as a variable i Value
char letter = 'L';
char *myLetter = &letter; // Statement 1 Pointer variables myLetter And directly initialize to letter The address of
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
Memory address
char * name = (char*)malloc(10); // Statement 1 Character pointer name
strcpy(name, "abcde123456");
printf("name=%s \n",name);
- 1.
- 2.
- 3.
- 4.
String constant
char * mystr = "welcome to c!"; // String constant
- 1.
NULL
NULL The address does not exist in memory , yes 0 Address
int *p1 = NULL;// Declare pointer variables p1, And initialize to NULL
- 1.
Wild pointer
char *p;
printf("p=%c \n",*p); // Will report a mistake
- 1.
- 2.
The wrong case
# *p p Must be a valid address , Otherwise, the program will crash
Wild pointer
char *p;
printf("p=%c \n",*p);
- 1.
- 2.
NULL
char *p = NULL;
printf("p=%s \n",*p);
- 1.
- 2.
边栏推荐
- 王-课外单词
- 我的vim配置文件
- Jz-061-serialized binary tree
- Vs code configuration problem
- 力扣每日一题刷题总结:二叉树篇(持续更新)
- Method recursion (Fibonacci sequence, frog jumping steps, tower of Hanoi problem)
- Using super ball embedding to enhance confrontation training
- c语言自定义类型枚举,联合(枚举的巧妙使用,联合体大小的计算)
- C language implements XML generation and parsing library (XML extension)
- Fundamentals of music theory (brief introduction)
猜你喜欢

Carsim-問題Failed to start Solver: PATH_ID_OBJ(X) was set to Y; no corresponding value of XXXXX?

On the back door of deep learning model

Development of digital collection trading website development of metauniverse digital collection

Principes fondamentaux de la théorie musicale (brève introduction)

Dynamic extensible representation for category incremental learning -- der

Vs code configuration problem

Carsim problem failed to start Solver: Path Id Obj (X) was set to y; Aucune valeur de correction de xxxxx?

Web安全--核心防御机制

CarSim learning experience - rough translation 1

c语言将字符串中的空格替换成%20
随机推荐
Chinese garbled code under vscade
力扣方法总结:双指针
Global and Chinese markets for Salmonella typhi nucleic acid detection kits 2022-2028: Research Report on technology, participants, trends, market size and share
On the confrontation samples and their generation methods in deep learning
16: 00 interview, came out at 16:08, the question is really too
类和对象(类和类的实例化,this,static关键字,封装)
Media query usage
Carsim-实时仿真的动画同步问题
力扣每日一题刷题总结:字符串篇(持续更新)
Animation synchronization of CarSim real-time simulation
The best blog to explain the basics of compilation (share)
Jupyter Notebook常用快捷键(在命令模式中按H也可查看)
Opencv3 6.3 reduced pixel sampling with filters
力扣每日一题刷题总结:二叉树篇(持续更新)
Array and string processing, common status codes, differences between PHP and JS (JS)
Installation and use of simple packaging tools
11月24号,我们为“满月”庆祝
STM32-新建工程(参考正点原子)
[dynamic planning] p4170: coloring (interval DP)
High school mathematics compulsory one