I try to print the value of address and it generates an error.
int main()
{
int arr[] = {10,20,30,40,50,60};
int *ip;
ip=&arr[3];
printf("%u",ip);
return 0;
}
I try to print the value of address and it generates an error.
int main()
{
int arr[] = {10,20,30,40,50,60};
int *ip;
ip=&arr[3];
printf("%u",ip);
return 0;
}
As noted the value of pointer is the address of the object to which it points. You print it using:
printf("%p",(void*) ip);
If you are interested in the value of the object the pointer points to - you need to dereference it, and then use in this case %d
format specifier:
printf("%d",*ip);