char *p;p=(char *)malloc(len+1);这样就申请了len+1个内存空间,并把第一个单元的地址强制为char *型指针赋给了char *型指针p。然后就可以像使用数组一样使用p了,如p[0]=3;等。