*a = *b;
The above statement will simply do this: value(a
) <– value(b
) (i.e. pointer a
will contain value ‘d’ ).
printf("%x\n", a);
This will print the pointer’s address(a
) in hexadecimal. However, always use the "%p"
format identifier to print the addresses. "%x"
is used to print the values in hexadecimal format.
printf("%x\n", *a);
Since the value(a
) is ‘d’ whose ASCII value is 100
(hundred in decimal).
Thus "%x"
will print the hexadecimal value of 100
which is 64
. Therefore this statement will print 64
.
No the above statement will not print the pointer’s address(b
).
However, pointer’s address(b
) can be printed by following statement:
printf("%p", b);
3
solved What does *a = *b mean in C? [closed]