Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22144

weird format output when i print a memory address in c

$
0
0

When I try this C code that prints the memory address of three variables:

int a = 45;float b;char c;printf("Address of a: %p \n", &a);printf("Address of b: %p \n", &b);printf("Address of c: %p \n", &c);

The output is :

Address of a: 0061FEB4Address of b: 0061FEB0Address of c: 0061FEAF

and I want it on the format like 0x7ffd3d518618. How can I do it?

I have executed the same code on a another computer under Ubuntu and the output shows in the format of 0x7ffd3d518618.


Viewing all articles
Browse latest Browse all 22144

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>