又要麻烦大家了,不知道什么地方出错了。。。。
代码如下:
程序代码:#include<stdio.h>
int init(block,siz)
{
int **block;
int siz;
int *aux;
if((zux=(int*)malloc(siz*sizeof(int)))==NULL)
return(0);
printf("enter %d integer values",siz);
*block=aux;
while(siz--)
scanf("%d",aux++);
return(1);
}
void main()
{
int *arr,i,size;
printf("array size:");
scanf("%d",size);
if(!init(&arr,size))
{
printf("cannot allocate memory\n");
exit(0);
}
for(i=0;i<size;i++)
printf("%d",arr[i]);
}
作用是动态定义要出入常量的空间大小,说是有好几个变量没有定义,但是我都定义了啊,麻烦大家指点一下~









