指针迷惑考点

    char ch[] = "iamhandsome";
    char *p = ch;

    printf("%c ,%c \n", *(p + 2), *p + 2);
    printf("%s \n", p + 10);
    printf("%d", *p + 2);
    printf("%d", *p);// 105 -> 第一个字母i的ASCII码值
 *p:105 -> 第一个字母'i'的ASCII码值
 *p + 2 = 105 + 2 = 107 107对应字母k
 *(p + 2) = m 解:ch数组顺序排列,+2就是向下移动两个从i移动到m位置,所以就是m,加几就像下移动几个

猜你喜欢

转载自blog.csdn.net/printf_hello/article/details/114476177