int * pi; int const * pci; - or - const int * pci; int *const cpi; int const * const cpci; - or - const int * const cpci; pi is a pointer to integer: both the pointer and the value it points to can be changed. pci is a pointer to a constant integer: the value it points to can't be changed, but the pointer itself can be. cpi is a constant pointer to integer. the value it points to can be changed, but the pointer itself can't be. cpci is a constant pointer to constant integer: neither the point or the value it points to can be changed. Bob Ammerrman RAm Systems ----- Original Message ----- From: "Niklas Lvvgren" To: Sent: Tuesday, February 26, 2002 6:48 AM Subject: SV: [pic]:struct+pointer is that true!? doesn't it point constantly at something that itself doesn't have to be constant? /niklas -----Ursprungligt meddelande----- Fren: Sergio Masci [mailto:smpl@NTLWORLD.COM] Skickat: den 26 februari 2002 14:59 Till: PICLIST@MITVMA.MIT.EDU Dmne: Re: [pic]:struct+pointer > > 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. > > p->temperature > > > > > Why??? 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 -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads