0

I have a function that takes a void** and I want to pass an integer in to the function but can not seem to figure out the syntax

here is the function prototype

bool pop(Node **stack, void **data)
2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by jsap
0

I think you have to do something like this because int** isn't a compatible type with void**.

int i = 123;
int *p = &i;

void pop( void **data ) {
  *data = p;
}

int main() {
  int *q;
  void *pv;

  pop( &pv );
  q = static_cast<int*>( pv );

  return 0;
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.