Printf以字符串作为参数

saa*_*arm 2 c output

考虑以下:

char abc[14] = "C Programming"; printf("%s", abc + abc[3] - abc[4]);
Run Code Online (Sandbox Code Playgroud)

上面的printf语句的输出是"rogramming".我似乎无法弄清楚如何获得此输出.

fja*_*don 5

因为字符是一种整数形式.

    abc + abc[3] - abc[4]
==> abc + 'r' - 'o'
==> abc + 3
Run Code Online (Sandbox Code Playgroud)

因此,您从索引3开始打印字符串abc.