当前位置:网站首页>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.
边栏推荐
- Live broadcast platform development, flexible menu, and freely adjust the horizontal size of the menu bar
- Global and Chinese market of tillage finishing machines 2022-2028: Research Report on technology, participants, trends, market size and share
- How to build the alliance chain? How much is the development of the alliance chain
- 路由基础—动态路由
- 类和对象(类和类的实例化,this,static关键字,封装)
- On the confrontation samples and their generation methods in deep learning
- c语言自定义类型枚举,联合(枚举的巧妙使用,联合体大小的计算)
- Carla-ue4editor import Roadrunner map file (nanny level tutorial)
- 王-课外单词
- Using super ball embedding to enhance confrontation training
猜你喜欢

使用wireshark抓取Tcp三次握手

VS Code配置问题

On the back door of deep learning model

Web安全--核心防御机制

C语言实现XML生成解析库(XML扩展)

How to build the alliance chain? How much is the development of the alliance chain

顺序表基本功能函数的实现

Use the kaggle training model and download your own training model

Using transformer for object detection and semantic segmentation

c语言自定义类型枚举,联合(枚举的巧妙使用,联合体大小的计算)
随机推荐
16: 00 interview, came out at 16:08, the question is really too
Data reverse attack under federated learning -- gradinversion
SQL操作数据库语法
2022 Heilongjiang latest construction eight members (materialman) simulated examination questions and answers
idea中注释代码取消代码的快捷键
Animation synchronization of CarSim real-time simulation
OpenCV 6.4 中值滤波器的使用
cve_ 2019_ 0708_ bluekeep_ Rce vulnerability recurrence
c语言自定义类型枚举,联合(枚举的巧妙使用,联合体大小的计算)
c语言自定义类型——结构体,位段(匿名结构体,结构体的自引用,结构体的内存对齐)
多站点高可用部署
Use Matplotlib to draw a preliminary chart
STL速查手册
Backup, recovery and repair of XFS file system
力扣方法总结:双指针
Global and Chinese market of tillage finishing machines 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets of tilting feeders 2022-2028: Research Report on technology, participants, trends, market size and share
Several methods of image enhancement and matlab code
使用wireshark抓取Tcp三次握手
Carsim 学习心得-粗略翻译1