当前位置:网站首页>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
边栏推荐
- 工程水文学复习资料
- 第05章 存储引擎【1.MySQL架构篇】【MySQL高级】
- Efficient use of RecyclerView Section 2
- ML.NET related resources
- 自动化测试如何创造业务价值?
- 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
- 在资源管理类中提供对原始资源的访问——条款15
- jeecg主从数据库读写分离配置「建议收藏」
- Codeforces Round #796 (Div. 2) (A-D)
- 多主复制的适用场景(2)-需离线操作的客户端和协作编辑
猜你喜欢
Synchronized and volatile interview brief summary
使用 GraphiQL 可视化 GraphQL 架构
为什么黑客领域几乎一片男生?
The use of button controls
MySQL的相关问题
The new BMW 3 Series is on the market, with safety and comfort
mysql黑窗口~建库建表
工程力学复习资料
Unity 之 图集属性详解和代码示例 -- 拓展一键自动打包图集工具
[Meetup Preview] OpenMLDB+OneFlow: Link feature engineering to model training to accelerate machine learning model development
随机推荐
leetcode303 Weekly Match Replay
Bilateral filtering acceleration "recommended collection"
更新数据表update
Implement anti-shake and throttling functions
OPPO在FaaS领域的探索与思考
Public Key Retrieval is not allowed error solution when DBeaver connects to MySQL 8.x
tensorflow2.0 cnn(layerwise)
npm安装时卡在sill idealTree buildDeps,npm安装速度慢,npm安装卡在一个地方不动
网站漏洞修复服务商关于越权漏洞分析
Emmet syntax
R language ggplot2 visualization: use the ggboxplot function of the ggpubr package to visualize the box plot, use the font function to customize the font size, color, style (bold, italic) of the legen
复制延迟案例(3)-单调读
苹果官网样式调整 结账时产品图片“巨大化”
The new BMW 3 Series is on the market, with safety and comfort
MySQL基础篇【单行函数】
Synchronized and volatile interview brief summary
腾讯云部署----DevOps
MySQL database operations
what exactly is json (c# json)
SIGABRT 报错时的注意事项和解决方法