Home > Software engineering >  We can declare pointer or dereferenced variable simply called variable, can we convert pointer to de
We can declare pointer or dereferenced variable simply called variable, can we convert pointer to de

Time:10-31

int* pointer=10; I want a variable which directly points to the contents of stored adress in pointer.

The cause of this act is that I have variable: dummy_type a; This a, has been used many time in my code. I've decide to allocate a with my static pool memory. Through the process of allocation I can have just it's pointer. But I need it's dereferenced version having name like a.

For example: int a=5; then you can extract it's pointer. But if you have int* pa=adress you can not create a dereference a. But I need a.

CodePudding user response:

I think what you want is something like this:

type_t * a_pointer;
#define a (*a_pointer)

If you remember to allocate memory at the right time and store your pointer in a_pointer then you don't need to change the rest of your code that was written to use a.

  • Related