#include <stdio.h>
#include <stdlib.h>
void push(int p)
{
static int i=0;
int b;
int *ptr =(int *)malloc((10)*sizeof(int));
ptr[i]=p;
for(b=0;b<=i;b++){
printf("%d",ptr[b]);
printf("\n");
}
i++;
}
int main()
{
int a;
while(1)
{
scanf("%d",&a);
push(a);
}
}
當我把新的價值觀,功能不是舊的entries.I等待你的幫助。我不能容納舊的條目
製作PTR靜態的,只能一次分配它。 – 2010-12-20 14:33:55
請學習使用代碼標記('{}')來清晰地格式化和突出顯示您的代碼。 – MAK 2010-12-20 14:37:49