I have written the following in C
, and would like to retrieve the address of the variable x
:
int x = 10;
int *address_of_x = &x;
printf("The address of x is: %s \n", address_of_x);
printf("The value of x is: %i \n", *address_of_x);
In this case, where I put %s
, I don't get any value. If I change it to %i
, I get an integer
value. I was expecting the address to be like having a mix of numbers and letters. So, does the letter following %
matter here, which seems does?
What should I do in this case to get the address of the variable x
?
Thanks.