we are implementing a priority queue for generic type of datas in C. We think the assignments between pointers etc. are made right, but we don't get how to print at the end the int value of "element". Can you help me?
#include <stdio.h>
#include <stdlib.h>
struct _pqElement{
void** data;
void** priority;
};
pqElement* pqElement_new(void* data, void* priority){
pqElement* result = (pqElement*) malloc (sizeof(pqElement));
result->data=&data;
result->priority=&priority;
return result;
}
static int* new_int(int value){
int *elem=(int*)malloc(sizeof(int));
*elem=value;
return elem;
}
int main(int argc, char const *argv[]){
pqElement * element = pqElement_new(new_int(1), new_int(85));
printf("%d-%d", element->data, element->priority);
}