Pheetuz
Full Member level 3

Hi Folks,
I have a pointer that has been returned to me via a malloc function on my PIC microcontroller, what I need to do is take the address of this pointer and store it as an INT such that I can place it in the FSR0L:FSR0H pair so that I can then use these registers for copying the stack, I am however having some difficulty doing this as I cannot seem to get the address of the variable pointed to by the pointer as a numerical value.
I have tried things such as:
UCHAR * stkPtr = NULL;
UINT stkAdd = 0;
void main (void){
malloc(stkPtr);
stkAdd = stkPtr;
}
or
void main (void){
malloc(stkPtr);
stkAdd = &(*stkPtr);
}
but to no avail, I know I am overlooking something stupid and would greatly appreciate it if someone could point me in the right direction.
Cheers,
Pheetuz
I have a pointer that has been returned to me via a malloc function on my PIC microcontroller, what I need to do is take the address of this pointer and store it as an INT such that I can place it in the FSR0L:FSR0H pair so that I can then use these registers for copying the stack, I am however having some difficulty doing this as I cannot seem to get the address of the variable pointed to by the pointer as a numerical value.
I have tried things such as:
UCHAR * stkPtr = NULL;
UINT stkAdd = 0;
void main (void){
malloc(stkPtr);
stkAdd = stkPtr;
}
or
void main (void){
malloc(stkPtr);
stkAdd = &(*stkPtr);
}
but to no avail, I know I am overlooking something stupid and would greatly appreciate it if someone could point me in the right direction.
Cheers,
Pheetuz