# include
# include
int main(void)
{
int len,* pArr;//vc6未完全支持C99,变量定义需在语句块一开始
printf("请输入你需要分配的数组的长度:len = ");
scanf("%d",&len);
//int * pArr = (int *)malloc(sizeof(int) * len);
pArr = (int *)malloc(sizeof(int) * len);//
*pArr = 4;
pArr[1]= 10;
printf("%d,%d",*pArr,pArr[1]);//
free(pArr);//把pArr所代表的动态分配的20个字节的内容释放
return 0;
}
# include
# include
int main(void)
{
int len;
printf("请输入你需要分配的数组的长度:len = ");
scanf("%d",&len);
int * pArr = (int *)malloc(sizeof(int) * len);
*pArr = 4;
pArr[1]= 10;
printf("%d,%d",*pArr,pArr[1]);
free(pArr);//把pArr所代表的动态分配的20个字节的内容释放
return 0;
}