当前位置:网站首页>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
边栏推荐
- type of timer
- C语言”三子棋“升级版(模式选择+AI下棋)
- 6-22 Vulnerability exploit - postgresql database password cracking
- WPF project - basic usage of controls entry, you must know XAML
- Matlab matrix basic operations (definition, operation)
- 数据表插入数据insert into
- R language moves time series data forward or backward (custom lag or lead period): use the lag function in the dplyr package to move the time series data forward by one day (set the parameter n to a p
- 浏览器自带的拾色器
- ML.NET related resources
- [Meetup Preview] OpenMLDB+OneFlow: Link feature engineering to model training to accelerate machine learning model development
猜你喜欢
C language "the third is" upgrade (mode selection + AI chess)
Kubernetes principle analysis and practical application manual, too complete
使用 GraphiQL 可视化 GraphQL 架构
工程力学复习资料
i.MX6ULL驱动开发 | 33 - NXP原厂网络设备驱动浅读(LAN8720 PHY)
How useful is four-quadrant time management?
WeChat chat record search in a red envelope
.NET 20周年专访 - 张善友:.NET 技术是如何赋能并改变世界的
mongo进入报错
Word table to Excel
随机推荐
Public Key Retrieval is not allowed error solution when DBeaver connects to MySQL 8.x
Foreign media right, apple on May be true in inventory
[Meetup Preview] OpenMLDB+OneFlow: Link feature engineering to model training to accelerate machine learning model development
mongo进入报错
Tencent Cloud Deployment----DevOps
Replication Latency Case (3) - Monotonic Read
t-sne 数据可视化网络中的部分参数+
How useful is four-quadrant time management?
Implement anti-shake and throttling functions
软件实现AT命令操作过程
更新数据表update
苹果官网样式调整 结账时产品图片“巨大化”
R language test whether the sample conforms to normality (test whether the sample comes from a normally distributed population): shapiro.test function tests whether the sample conforms to the normal d
Deployment application life cycle and Pod health check
SIGABRT 报错时的注意事项和解决方法
How does automated testing create business value?
网站漏洞修复服务商关于越权漏洞分析
Vb how to connect mysql_vb how to connect to the database collection "advice"
双边滤波加速「建议收藏」
WeChat chat record search in a red envelope