C pointers

* Once a variable is declared, we can get its address by preceding its name with the unary & operator, as in &k.
* We can “dereference” a pointer, i.e. refer to the value of that which it points to, by using the unary ‘*’ operator as in *ptr.
* An “lvalue” of a variable is the value of its address, i.e. where it is stored in memory.
The “rvalue” of a variable is the value stored in that variable (at that address).

#include <stdio .h>
 
int main()
{
int k=3;
int *ptr;
 
ptr = &k;
printf("The value ptr is pointing to:%d at address:%p\n", *ptr, ptr);
}
</stdio>

Leave a Reply