> -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf > Of MSR7 > Sent: 14 April 2010 17:43 > To: piclist@mit.edu > Subject: [PIC] Basic question abou pointer > > > Hi all, > > I declared a struct with four member byte variables, where one member is a > pointer, like this: > > struct Temp > { > unsigned char Var00; > unsigned char Var01; > unsigned char Var02; > unsigned char *Var03; > }; > > When i watch the values in the Watch window, all the variables have eight > bits, except the pointer variable, which is 16 bits. > > All the pointer variables will have 16 bits, whatever you declare it as > byte > or word? The size of the pointer is determined by the range of addresses it has to cover, and this is the same irrespective of the data type it is pointing to. For instance with the older HiTech compiler with a 14 bit target you could define a pointer which could only cover two banks, and since a bank is 128 bytes this pointer was only 8 bits in size. A pointer to program memory was always 16 bits in size in this case. If you start using a micro with a very large address space (e.g. 32 bit micros such as ARM/MIPS etc), then the pointers are going to be proportionally larger due to the much larger address space. Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist