Pointer to Object

Started by
0 comments, last by Xero-X2 21 years, 6 months ago

int ME = 5;//make int
int *v=&ME//make pointer to int
int d=v;   //make number equal to int that pointer points to (WARNING!)
 
Is there a way that I can do this. I have finally run into a problem that requires me to do this, normaly I find a way around it but This time there isn''t one. please help.
"I seek knowledge and to help those who also seek it"
Advertisement
quote:Original post by Xero-X2
int ME = 5;//make intint *v=&ME//make pointer to intint d=v;   //make number equal to int that pointer points to (WARNING!)   


Is there a way that I can do this. I have finally run into a problem that requires me to do this, normaly I find a way around it but This time there isn't one. please help.


Your problem is your assiging a address to a variable.
do this

  int ME = 5;int *v = &MEint d = *v;   


now d will have the value of *v and not the address. Hope that helps.

"You have Freedom, sir"
"Were do I have freedom"
"Only in your head, we control the rest of your body and life for now"
"My FREEDOM isn't for sale"

[edited by - Mars_999 on October 19, 2002 11:12:24 PM]

This topic is closed to new replies.

Advertisement