I'm just getting started in C++, moving from higher level languages. For something I'm building, I'm allocating space, then figuring out what kind of object you have. It's rather like the below, but the below doesn't work - I expect to get back my 45, but am getting a memory location, I think. What did I mess up?
void *ptr;
int a = 45;
ptr = malloc(sizeof(int));
memcpy(ptr, &a, sizeof(int));
int *b;
b = (int*)ptr;
std::cout << &b;