Add pointer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add pointer

517 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Wed Jul 21 00:42:14 MST 2010
LPCXpresso with LPC1758

I have this sample code (0x00078000  + 0x00007F00 = 0x0007FF00):

  uint32_t *pnt, *a;
  pnt = (uint32_t *)SECTOR_29_START;
  a = (uint32_t *) (pnt + 0x00007F00);

At the end of this two line in debug the variable have this inccorect value
uint32_t * "pnt" = 0x00078000   
uint32_t * "a" = 0x00097c00   

What do  the calculation? ?

Thanks

Original Attachment has been moved to: 1100554_New%20Text%20Document.txt.zip

Original Attachment has been moved to: 1100554_New%20Text%20Document.txt.zip

Original Attachment has been moved to: 1100554_New%20Text%20Document.txt.zip

Original Attachment has been moved to: 1100554_New%20Text%20Document.txt.zip

Original Attachment has been moved to: 1100554_New%20Text%20Document.txt.zip

Original Attachment has been moved to: 1100554_New%20Text%20Document.txt.zip

0 Kudos
2 Replies

434 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Wed Jul 21 05:09:56 MST 2010

Quote: CodeRedSupport
The code you have written is incrementing pnt by (0x7f00 * sizeof(*pnt)), that is 4*0x7f00 = 0x1fc00. This is standard C pointer arithmetic.



OK thanks
0 Kudos

434 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Wed Jul 21 02:23:55 MST 2010
The code you have written is incrementing pnt by (0x7f00 * sizeof(*pnt)), that is 4*0x7f00 = 0x1fc00. This is standard C pointer arithmetic.
0 Kudos