编译成功却不能运行?
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define null 0;
void mem_cpy(char *s)
{
s=(char*)malloc(100);
}
void main()
{
char *p;
p = null;
char *t ="sdfasdfasdf";
mem_cpy(p);
strcpy(p,t);
printf("%s",p);
}
把t所指的内容附给p所指的内存区域
编译通过不能运行
为什么?
如何修改?