Hi all,
I have a variable pointer, which i allocate the memory using the malloc command. I want to reverse the order of the variable pointer. But how do i know the last memory address for this?
Code:
#define ARRAY_SIZE 100;
..
int x = ARRAY_SIZE
int *pa, *pb, *pc, *pd;
pa = malloc(sizeof(int))*x);
int j = 0;
for(j=0; j<6;j++)
{
pa[j] = j+1; //sign pa = {1,2,3,4,5,6}
pb[j] = j+7; //sign pb = {7,8,9,10,11,12}
}
i want to reverse the order of pa, so it become {6,5,4,3,2,1}, but how do i know the address of memory with value 6. Any idea?
Thanks you