当前位置:网站首页>Character pointer assignment [easy to understand]
Character pointer assignment [easy to understand]
2022-07-31 15:48:00 【Full stack programmer webmaster】
Hello everyone, we meet again, I'm your friend Quanstack Jun.
Program 1: Assign two identical strings to two different pointers.Compare two pointers
#include
printf("%p/n",a); printf("%d/n",sizeof(a)); //Define a pointer (one byte), the value in the pointer variable is random,So this pointer is also called a dangling pointer.a = "hello"; printf("%p/n",a); printf("%d/n",sizeof(a)); char *b="hello"; printf("%p/n",b); printf(“%d/n”,sizeof(b));
if(a==b) printf("YES"); else printf("NO"); getchar();
}
Program 2: Assign two identical characters to two different pointers.Compare two pointers
#include
if(a==b) printf("YES"); else printf("NO"); getchar();
}
Program 3: Assign the string "A" to the character pointer;
#include
if(a==b) printf("YES"); else printf("NO"); getchar();
}
The result is
1.
2.
3.
Summary:
1. Assigning a string to a pointer is to pass the first address of the string to the pointer.
2. Assigning a character to a pointer means passing the ACSII of the character to the pointer.
Publisher: Full stack programmer, please indicate the source: https://javaforall.cn/127987.htmlOriginal link: https://javaforall.cn
边栏推荐
- 复制延迟案例(3)-单调读
- 工程水文学复习资料
- Internet banking stolen?This article tells you how to use online banking safely
- 数据表插入数据insert into
- Applicable Scenarios of Multi-Master Replication (1) - Multi-IDC
- 网站漏洞修复服务商关于越权漏洞分析
- Oracle动态注册非1521端口
- 基于ABP实现DDD
- 「秋招系列」MySQL面试核心25问(附答案)
- Implementing click on the 3D model in RenderTexture in Unity
猜你喜欢

What is the difference between BI software in the domestic market?

Kubernetes原理剖析与实战应用手册,太全了

长得很怪的箱图

Use of radiobutton

mongo enters error

"Autumn Recruitment Series" MySQL Interview Core 25 Questions (with answers)

The 2nd China PWA Developer Day

C程序是如何跑起来的01 —— 普通可执行文件的构成

工程力学复习资料

基于Redis(SETNX)实现分布式锁,案例:解决高并发下的订单超卖,秒杀
随机推荐
Precautions and solutions when SIGABRT error is reported
TRACE32 - SNOOPer-based variable logging
jeecg主从数据库读写分离配置「建议收藏」
The principle of hough transform detection of straight lines (opencv hough straight line detection)
Premiere Pro 2022 for (pr 2022)v22.5.0
数据库的范式(第一范式,第二范式,第三范式,BCNF范式)「建议收藏」
org.apache.jasperException(could not initialize class org)
小程序:matlab解微分方程「建议收藏」
Unity中实现点选RenderTexture中的3D模型
MySQL的相关问题
MySQL多表联合查询
Kubernetes common commands
Handling write conflicts under multi-master replication (4) - multi-master replication topology
【7.29】代码源 - 【排列】【石子游戏 II】【Cow and Snacks】【最小生成数】【数列】
ansible study notes 02
对话庄表伟:开源第一课
ML.NET related resources
Browser's built-in color picker
C language "the third is" upgrade (mode selection + AI chess)
Applicable scenario of multi-master replication (2) - client and collaborative editing that require offline operation