关于指针的小程序,为什么错了,谁能详解了呢,谢谢了。
程序代码:#include <stdio.h>
void aa(char *p)
{
p=(char *)malloc(10);
}
void main()
{
char *str = NULL;
aa(str);
strcpy(str,"12345");
printf("%s",str);
}
p不就是str吗,给p分配了5个字节的内存,不就是给str分配了嘛 为什么还出错呢。。怎么改呢?










