How do I create an array of pointers in program space (ROM)?

If the array is being placed in data memory, this would be because you have put the const qualifier before the * in the array definition, e.g.

This makes the const bind to the type pointed to, rather than to the array itself. Put the const keyword immediately before the array name, for example:

Remember that if the object is const, you will need to provide initial values when you define the object.

In some situations you may want to have a const array pointing to const data, in which case you would have const both before and after the *, e.g.

The rule is, anything to the left of the star in a pointer definition refers to what the pointer accesses indirectly; anything to the right refers to the pointer variable itself.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.