2
说,如果我想打印出我的整数存储在一个“阵列”,这确实是一个指针memory.When我用里面的代码:知道指针指向的有效元素大小的方法是什么?
int main(void)
{
int *arr = malloc(3*sizeof(int));
int *p = arr;
*arr++=1;
*arr++=2;
*arr=3;
while (??) // what should be filled in the while?
printf("%d",*p); // so that we can get the validly stored elements?
return 0;
}
请了解如何格式化您的代码。 – 2012-04-07 20:31:49