I am missing something obvious here but consider the following,
int k = 10;
int *p = &k;
int i = (int)p;
above produces,
warning: cast from pointer to integer of different size
and following,
int k = 10;
int *p = &k;
int i = p;
causes,
warning: initialization makes integer from pointer without a cast
a bit of googling lead me to,
Converting a pointer into an integer
which advices using uintptr_t,
int k = 10;
int *p = &k;
int i = (uintptr_t)p;
above works no errors no warnings. So my question is k is an int and p is an int pointer pointing to k why do i get an error dereference p?