I came across the following code, the output for which is 0.
Is the statement vptr = &i correct? Can we assign a void pointer, address of an integer variable?
#include<stdio.h>
void fun(void *p);
int i;
int main()
{
void *vptr;
vptr = &i;
fun(vptr);
return 0;
}
void fun(void *p)
{
int **q;
q = (int**)&p;
printf("%d\n", **q);
}