This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Pointer Variable on LCD

Hi all...
i need to print a value of pointer variable in 16x2 LCD...
for Eg.

void main()
{
int *a = 20;
int b;
*a=&b;
print_LCD(value of pointer variable a)
}


here is a simple example where i have declared a pointer variable 'a' whoes value is 20.
and then i stored the value of pointer variable at the address of variable b.
but i need to print the value of pointer variable on LCD screen.
how can i do this....
can anybody help me please....

Parents
  • I think this is a good time to open a book about basic C programming.

    You really need to understand the difference between the value of a pointer and the value a pointer points to.

    You are assigning the _address_ 20 to the pointer.
    You are then storing the address of b into the memory pointed to by the pointer - so at memory address 20 you are storing the address of the variable b.

    What do you really would be printed if you then tries to print the value of the variable a? Shouldn't the variable a still store the address 20?

Reply
  • I think this is a good time to open a book about basic C programming.

    You really need to understand the difference between the value of a pointer and the value a pointer points to.

    You are assigning the _address_ 20 to the pointer.
    You are then storing the address of b into the memory pointed to by the pointer - so at memory address 20 you are storing the address of the variable b.

    What do you really would be printed if you then tries to print the value of the variable a? Shouldn't the variable a still store the address 20?

Children