c语言 11-1

1、

#include <stdio.h>

int main(void)
{
    char *p = "123";
    printf("p = %s
", p);
    p = "456";
    printf("p = %s
", p);
    
    return 0;
}

#include <stdio.h>

int main(void)
{
    char *p = "123";
    printf("p = %s
", p);
    p = "456" + 1;  //指针p + i 等价于 &a[i],指针p由指向“4”的指针改为指向“5”的指针,因此显示56.??
    printf("p = %s
", p);
    
    return 0;
}

原文地址:https://www.cnblogs.com/liujiaxin2018/p/14829381.html