关于malloc函数的,请各位看看错在哪?
/*malloc函数的使用*/#include<stdio.h>
#include<stdlib.h>
#define NULL 0
main()
{
int *p,*table;
int size;
printf("\nwhat is the size of table?");
scanf("%d",size);
printf("\n");
if((table=(int*)malloc(size*sizeof(int)))==NULL)
{
printf("no space available");
exit(1);
}
else
{
printf("\n address of the first byte is %u\n",table);
printf("\n input table value\n");
for(p=table;p<table+size;p++)
scanf("%d",p);
for(p=table+size-1;p>=table;p--)
printf("%d is stored in address %u \n",*p,p);
}
}