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)
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)
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;
}
that worked, thanks
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.