Alberto Rosello
Posts: 4
Joined: Mon Aug 06, 2018 10:45 pm

WHY MEMORY POSITIONS DO NOT APPEAR IN HEXADECIMAL

Mon Aug 06, 2018 11:09 pm

is a small program of direction visualization of an array of 10 numbers through pointers, as you know a pointer must store the consecutive addresses of the arrangement, but I get the surprise that for example jumps from position 68 to 72 and passes overlook position 6C (hexadecimal numbers are not listed !!!)

Can someone please explain this to me?

I enclose the result where the memory addresses are shown

Image
Attachments
memory.jpg
memory.jpg (67.02 KiB) Viewed 499 times

procount
Posts: 1294
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: WHY MEMORY POSITIONS DO NOT APPEAR IN HEXADECIMAL

Tue Aug 07, 2018 7:38 am

Maybe because ALL the memory addresses are being shown in decimal?

(Hexadecimal numbers without letters are not the same as decimal numbers - they are still hexadecimal. They are usually prefixed with 0x so you can tell the difference and interpret them correctly.)
Last edited by procount on Tue Aug 07, 2018 10:04 am, edited 1 time in total.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

Heater
Posts: 10012
Joined: Tue Jul 17, 2012 3:02 pm

Re: WHY MEMORY POSITIONS DO NOT APPEAR IN HEXADECIMAL

Tue Aug 07, 2018 7:55 am

I'm pretty sure all those numbers are decimal. Notice how the increment by 4 each time, which is what we might expect if the pointer is to integer data or machine instructions.

How are you printing those numbers?

If you are using printf() from C, for example, you will need the correct format specifier for hexadecimal output. Google it.

Why is you post title all in upper case characters?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5816
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: WHY MEMORY POSITIONS DO NOT APPEAR IN HEXADECIMAL

Tue Aug 07, 2018 10:01 am

Heater wrote:
Tue Aug 07, 2018 7:55 am
If you are using printf() from C, for example, you will need the correct format specifier for hexadecimal output. Google it.
Or do

Code: Select all

man 3 printf
to print out the manual page for printf.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “General programming discussion”