View previous topic :: View next topic |
Author |
Message |
sonu2die4
Joined: 10 Aug 2009 Posts: 9
|
Pointer Address |
Posted: Sun Feb 21, 2010 12:40 am |
|
|
Hi,
I was wondering as to how to get an address of a pointer which contains an integer, ex:
Code: |
int main(){
int a;
int *ptr;
ptr=&a;
printf("\n\r %p",(void *) ptr);
}
|
Would the above snippet work? I tried on my compiler and it did not. Version 4.057.
Thank You
Vivek |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Feb 21, 2010 1:06 am |
|
|
I don't think "%p" is supported by CCS, but you can use "%lx" instead.
This assumes you are using 16-bit pointers (optional in PCM, but always
in the PCH compiler).
If that doesn't answer your question, then post your PIC (actually, you
should always post your PIC so we know your compiler). |
|
![](templates/subSilver/images/spacer.gif) |
sonu2die4
Joined: 10 Aug 2009 Posts: 9
|
|
Posted: Sun Feb 21, 2010 1:07 am |
|
|
Thanks...It is PIC16f877a... |
|
![](templates/subSilver/images/spacer.gif) |
|