【发布时间】:2013-10-01 14:43:02
【问题描述】:
#include<stdio.h>
int main()
{
printf("%s\n", "Hello");
printf("%s\n", &"Hello");
return 0;
}
Output :
Hello
Hello
谁能向我解释为什么"Hello" 和&"Hello" 会产生相同的结果?
【问题讨论】:
-
C 中没有引用。一元
&是地址运算符。 -
@alkis 你没有编辑标题?
-
你使用哪个编译器,顺便说一句?
-
@devnull 我在 windows 上使用 dev-c++ 作为我的 ide(仅用于测试),它使用 Mingw,它是 GCC 的一个端口
-
@alkis 所以编译器没有任何选项来启用任何警告?
标签: c string printf address-operator