Posts

Showing posts with the label get

Difference b/w getting an address of variable using %p and %d

Difference b/w getting an address of variable using %p and %d Here is an example #include <stdio.h> int main() { int a; printf("%dn",&a); printf("%pn",&a); return 0; } ======Output======= -2054871028 0x7ffd8585280c Do these two address point to same address in RAM ? And how can i get the value by using each one of them, especially the second one. Try printing as %x instead of %d. What do you mean by value? The value of a pointer is its address. – cup Jun 30 at 4:24 value of the variable "a". – Ritesh95 Jun 30 at 4:29 ...