int * p =(int *)malloc(256 * sizeof(int)); //Let him point to a dynamically allocated memory block.
or
int a[256]= { 0 };
int i,* p;
p = a;
for(I = 0; I & lt256; i++)
{
*(p+I)= I;
}
It's okay, let p point to an array a.
Only one int can be stored in dynamically allocated memory.
p =(int *)malloc(sizeof(int));
change into
p =(int *)malloc(sizeof(int)* 256);