I have the following C program:
int main()
{
int i = 5;
printf("Simple value of i = %d", i);
printf("\nPointer value of i = %d", *(&i));
return 0;
}
Both of them printf()will print the same as 5. According to my understanding, it is &used for the value of the address, and is *used to select the value at this address.
My question is: why do we need *(&i)if the same thing can be achieved by a simple variable i?
source
share