我已经在一个混淆程序中读了下面的代码.
我想知道为什么编译器在我这样做时给了我一个警告而不是一个错误.代码真正想做什么以及为什么编译器建议我使用数组?
#include <stdio.h>
int main()
{
int f = 1;
printf("hello"+!f);
return 0;
}
warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
printf("hello"+!f);
~~~~~~~^~~
note: use array indexing to silence this warning
printf("hello"+!f);
^
& [ ]
Run Code Online (Sandbox Code Playgroud)