POINTERS AND ACCESS VALUES

Pointers are variables that have as their value an address, i.e. a reference to another data object. Given a pointer we can access the value "pointed" to through a process known as dereferencing.


C POINTERS

Consider the following example:

#include 

void main(void)
{
int n, *nptr;

scanf("%d",&n);

nptr = &n;
printf("Value of n = %d\n",n);
printf("Address of n = %d\n",&n);
printf("Value of nptr = %d\n",nptr);
printf("Address of nptr = %d\n",&nptr);
printf("Value pointed at by nptr = %d\n",*nptr);
}

Input integer n , and then .

Note that the address of n and the value of nptr are the same.

Ada Access Values



Created and maintained by Frans Coenen. Last updated Wednesday July 3 1996.