[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Accessing structures defined in ROM ?
From: |
Vincent Trouilliez |
Subject: |
Re: [avr-gcc-list] Accessing structures defined in ROM ? |
Date: |
Mon, 26 Sep 2005 18:54:34 +0200 |
On Mon, 2005-09-26 at 10:24 -0500, Andy Warner wrote:
> Vincent Trouilliez wrote:
> > [...]
> > i = pgm_read_byte( p->nb ); //should return 3, but doesn't...
>
> Try:
>
> i = pgm_read_byte(&(p->nb));
>
> After all, pgm_read_byte() takes the address of a byte to read,
> so you need to pass it the _address_ of the object you want.
Thanks Andy and Bernard, that worked. But I don't really understand the
syntax. Doesn't "p->nb" mean "the address of the element nb that's in
the structure pointed to by pointer p" ?? So adding a '&' means, take
the address of that address... passing the address of the address of
the data....does that make sense ?! :-/
Brrr, I am very confused now...
--
Vince