#include <stdio.h>
#include <malloc.h>
#include <process.h>
void main( )
{
int count;
int *array;
if(( array = (int *) malloc (10 * sizeof(int))) == NULL)
{
printf("不能成功分配存储空间");
exit(1);
}
for (count=0;count<10;count++)
array[count]=count;
for(count=0;count<10;count++)
printf("%2d",array[count]);
free(array);
}
在网上看到的一段错误代码,在这里改过贴上去