ptr

how can i pass pointer to function? i mean the not the address


this is my code
1
2
3
void func (  *ptr ); // prototype
drugStore *myDrugStore = new drugStore[2] = {4,4};
void func ( *myDrugstore ){} // i dont know if this is right 

i am forced in my code to do like this
Last edited on
how can i pass pointer to function? i mean the not the address

hah.

1
2
3
4
5
6
7
8
9
void func ( drugStore * ptr );

void func ( drugStore * ptr )
{
  if (0 != ptr)
  {
   ptr->DoSomething();
  }
}
1
2
3
4
5
6
7
8
9
void func ( drugStore * ptr );

void func ( drugStore * ptr )
{
  if (0 != ptr)
  {
   ptr->DoSomething();
  }
}


1
2
drugStore *myDrugStore = new drugStore;
func(myDrugStore);
i see thanks. im scared to try it myself before creating a thread :(
Topic archived. No new replies allowed.