小编Pik*_*acz的帖子

C 字符串和十六进制字符

谁能解释一下这段代码中发生了什么?

    #include <stdio.h>

    void f(const char * str) {
      printf("%d\n", str[4]);
    }

    int main() {
      f("\x03""www""\x01""a""\x02""pl");
      f("\x03www\x01a\x02pl");
      return 0;
    }
Run Code Online (Sandbox Code Playgroud)

为什么是输出?

    1
    26
Run Code Online (Sandbox Code Playgroud)

c c-strings

5
推荐指数
1
解决办法
6772
查看次数

标签 统计

c ×1

c-strings ×1