I can't seem to pass pointer to memory address. I thought the following code would pass the memory address that ptr points at, to my func(), then when I print out the address within func() it would show the same address as ptr did from within main(), however that's not what I'm seeing. p's address is different from ptr's address.
How do I correctly pass a pointer to functions?
#include <iostream>
using namespace std;
void func(int* p)
{
    printf("p address: %p\r\n", &p);
}
int main()
{
    int* ptr;
    memset(&ptr, 0, sizeof(int));
    printf("ptr address: %p\r\n", &ptr);
    func(ptr);
}
 
     
    