【发布时间】:2014-11-23 06:42:47
【问题描述】:
以下比较是否保证正确?
"hello world"=="hello world";
此外,以下内容是否始终保证为 false?
char a[] = "hello world";
a == "hello world";
【问题讨论】:
-
字符串,无论其物理位置如何,都必须使用字符串函数之一进行比较,例如 strcmp( "hello world", "hello world" ); IE。比较运算符“==”只会比较数组的地址,这些地址可能相同也可能不同。
标签: c