CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Pointer Address

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sonu2die4



Joined: 10 Aug 2009
Posts: 9

View user's profile Send private message

Pointer Address
PostPosted: Sun Feb 21, 2010 12:40 am     Reply with quote

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
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Feb 21, 2010 1:06 am     Reply with quote

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).
sonu2die4



Joined: 10 Aug 2009
Posts: 9

View user's profile Send private message

PostPosted: Sun Feb 21, 2010 1:07 am     Reply with quote

Thanks...It is PIC16f877a...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group