hi all,
let say i have a pointer exit, and this exit will store some value. how can i store the value that the pointer points to into an array and then print them out from the array.
thanks in advance
hi all,
let say i have a pointer exit, and this exit will store some value. how can i store the value that the pointer points to into an array and then print them out from the array.
thanks in advance
If I understand your question correctly:
If exitptr is a pointer to integer and it points to an array of 10 integers, this is how you can print them:-
for (i=0, i<10, i++)
{
printf("%d = %d", i+1, *(exitptr+i));
}
For storing the values in a array, declare an array of 10 integers and copy the values into them.
int int_arr[10];
for (i=0, i<10, i++)
{
int_arr [i]= *(exitptr+i);
}
yap i got that sort out, thanks...