#include <stdio.h>
#include <string.h>
main()
{
    int *a,*b,*c;
    a=b=c=(int *)malloc(sizeof(int));
    *a=1;
    *b=2;
    *c=3;
    a=b;
    printf("%d %d %d\n",*a,*b,*c);
}

你觉得上边输出什么?

输出 3 3 3

原因在于,a,b,c 被赋予同一个内存空间,所以,只有最后一个元素赋值才有作用,即3

本题在于理解指针malloc的作用,开辟的地址