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)
Re: void** syntax question 80 80

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;
Re: void** syntax question 80 80

that worked, thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.