当前位置:网站首页>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
边栏推荐
- WPF project - basic usage of controls entry, you must know XAML
- Ubantu project 4: xshell, XFTP connected the virtual machine and set xshell copy and paste the shortcut
- 自动化测试如何创造业务价值?
- Emmet syntax
- Kubernetes common commands
- 工程水文学名词解释总结
- Delete the disk in good condition (recovery partition)
- 更新数据表update
- 多主复制下处理写冲突(4)-多主复制拓扑
- After Grafana is installed, the web opens and reports an error
猜你喜欢
Ubantu project 4: xshell, XFTP connected the virtual machine and set xshell copy and paste the shortcut
TRACE32 - SNOOPer-based variable logging
Browser's built-in color picker
工程流体力学复习
为什么黑客领域几乎一片男生?
Why is the field of hacking almost filled with boys?
WPF项目--控件入门基础用法,必知必会XAML
11 pinia使用
Grafana安装后web打开报错
第05章 存储引擎【1.MySQL架构篇】【MySQL高级】
随机推荐
工程力学复习资料
jeecg主从数据库读写分离配置「建议收藏」
Implementing click on the 3D model in RenderTexture in Unity
字符串反转的实现方法总结「建议收藏」
Linux查看redis版本(查看mongodb版本)
[Meetup Preview] OpenMLDB+OneFlow: Link feature engineering to model training to accelerate machine learning model development
R language ggplot2 visualization: use the ggmapplot function of the ggpubr package to visualize the MA plot (MA-plot), the font.legend parameter and the font.main parameter to set the title and legend
update data table update
Word table to Excel
删除表格数据或清空表格
Matlab矩阵基本操作(定义,运算)
Gorm—Go language database framework
11 pinia使用
使用 GraphiQL 可视化 GraphQL 架构
R language ggplot2 visualization: use the ggboxplot function of the ggpubr package to visualize the grouped box plot, use the ggpar function to change the graphical parameters (caption, add, modify th
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
苹果官网样式调整 结账时产品图片“巨大化”
Efficient use of RecyclerView Section 2
MySQL数据库操作
软件实现AT命令操作过程