I am having a very hard time figuring out how to solve the following problem. I am on an embedded system with very little memory and want to minimize memory usage. Pointers
Usual way is to declare a struct, for example :
struct RegsAtAddrA
{
unsigned int array1[10];
char val1;
// etc
};
then to access it :
volatile RegsAtAddrA *pRegsA = (volatile RegsAtAddrA *) 0x40004000;
pRegsA->val1= 'a';
//etc
EDIT: I just realized that I haven't answered the question. So, here it is :
#include
unsigned long a=1;
unsigned long b=2;
volatile unsigned long *port_base_array[] = {
&a,
&b,
//etc
};
int main()
{
std::cout<<"a="<<*port_base_array[0]<