其实这个"A"="A"的比较,是两个字符串常量的地址比较,存在不同的地方,当然值不同,这正常!
原帖由 "C A Reference Manual" 发表:
2.7.4 String Constants
......
Do not depend on all string constants being stored at different addresses. Standard C allows implementations to use the same storage for two string constants that contain the same characters.
......
why.GIF (3.04 KB, 下载次数: 11)
运行结果的载图
lj.JPG (6.17 KB, 下载次数: 11)
merge_string.JPG (58.19 KB, 下载次数: 14)
char why[10]="world";
p="world";
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |