c - 这个 printf 是什么意思?

标签 c printf

<分区>

printf("%c","abcdefgh"[4]);

以下程序的输出是e。但是不知道怎么样?我在谷歌和这里搜索了很多但没有找到这段代码的正确解释。我得到的这段代码的解释:

"This is for getting one char only. i.e, the 4th char starts from 0. So the answer is 'e'".

最佳答案

字符串文字是数组,因此可以索引到:"abcdefgh"[0] is 'a',例如。

关于c - 这个 printf 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11907030/

相关文章:

c - 在指向结构的指针上打印错误值

c - 在 Windows 中不使用回车符 (CR) 将新行打印到文本文件

c - 如何在 C 中将 char 字符串复制/转换为 wchar_t 字符串?

c++ - 让 printf 忽略零值上的负号

c++ - _CrtSetAllocHook - 未处理的异常

将字符串数组中的值连接到 c 中的另一个静态字符串

使用 sprintf 将字符串居中

c - 我如何在 C 中打印到 stderr?

c - 如何生成0到1之间的随机数?

C字符串函数错误