----- Original Message ----- From: Also-Antal Csaba To: Sent: Tuesday, February 26, 2002 3:30 PM Subject: Re: [pic]:struct+pointer > Sergio Masci wrote: > > > > > > cost ship * p; > > > > is this cost actually const? > > > > You can read from but not write to a const location. > > const meens constant, unchanging. Declaring a const > > pointer meens that it points to something which must > > not be changed. > > > > > > p=&ship1; > > > > (*p).temperature=123; > > > > the error message is same. > > The p pointer is const, but the &ship1 expression is the address of the > ship1 variable. (*p).temperature=123; is point to the ship1.temperature > varible. So the ship1.temperature=123; and (*p).temperature=123; is must > be equal. When i read from work, when write not, this looks like a bug. no the pointer is not const, it is a pointer to a const. to get a const pointer you would write: ship * const p; Regards Sergio -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads