#include<stdio.h>
int *addressof();
int main()
{
int *p=addressof();
printf("%u",p);
return 0;
}
int *addressof()
{
int x=9;
return &x;
}
Output:
0
Can the address of the variable be zero? Is it possible?
%uformat specifier forprintfexpects anunsigned intargument. To print avoid *pointer (you need to cast to be correct) use%p. Mismatching format specifier and argument type leads to undefined behavior.