well.... manwhoonlyeats, your source code is in error, but i will try to correct it.
Code:
if ((ptr=(int*)malloc(sizeof_array*sizeof(int)))==NULL)
// look messy...
DieWithError("Error on malloc");
try to fix it with ....
Code:
..
ptr=(int*)malloc(sizeof(int));
if (!ptr)
{
printf ("error...");
exit (100);
}
else ...... // the malloc process was done successfully
..
another error....
Code:
original_ptr=ptr; // no need for it
for (i=0; i<.....; i++){
printf("Input number %d:",i);
scanf("%d",&num);
*ptr=num;
ptr++;
} // no need for this, but the easy way...
correction
Code:
for (count = 0 ; *(ptr+count) != NULL ; count++)
{
printf("Input number %d:",count+1);
scanf("%d", &( *(ptr+count) ) );
}
i need some info, why use this ?
Code:
DieWithError("Error on malloc");
another error on the printf situation, have a look ..
Code:
for (count = 0 ; *(ptr+count) != NULL ; count++)
printf("Element %d=%d\n",count ,*(ptr+count) );
// end of printing element
free (ptr); // free the ptr mem
i might knew that my correction might be wrong, i didn't check in computer. however, their guy should help me to correct my error. good luck ...
-- beely