Simply stated, a pointer is an address. Instead of being a variable, it is a pointer to a variable stored somewhere in the address space of the program. It is always best to use an example so load the file named pointer.c and display it on your monitor for an example of a program with some pointers in it.
main( ) /* illustratrion of pointer use */
{
int index,*pt1,*pt2;
index = 39; /* any numerical value */
pt1 = &index; /* the address of index */
pt2 = pt1;
printf("The value is %d %d %d\n",index,*pt1,*pt2);
*pt1 = 13; /* this changes the value of index */
printf("The value is %d %d %d\n",index,*pt1,*pt2);
}
For the moment, ignore the declaration statement where we define "index" and two other fields beginning with a star. It is properly called an asterisk, but for reasons we will see later, let’s agree to call it a star. If you observe the first statement, it should be clear that we assign the value of 39 to the variable "index". This is no surprise, we have been doing it for several programs now. The next statement however, says to assign to "pt1" a strange looking value, namely the variable "index" with an ampersand in front of it. In this example, pt1 and pt2 are pointers, and the variable "index" is a simple variable. Now we have problem. We need to
learn how to use pointers in a program, but to do so requires that first we define the means of using the pointers in the program.
The following two rules will be somewhat confusing to you at first but we need to state the definitions before we can use them. Take your time, and the whole thing will clear up very quickly.
main( ) /* illustratrion of pointer use */
{
int index,*pt1,*pt2;
index = 39; /* any numerical value */
pt1 = &index; /* the address of index */
pt2 = pt1;
printf("The value is %d %d %d\n",index,*pt1,*pt2);
*pt1 = 13; /* this changes the value of index */
printf("The value is %d %d %d\n",index,*pt1,*pt2);
}
For the moment, ignore the declaration statement where we define "index" and two other fields beginning with a star. It is properly called an asterisk, but for reasons we will see later, let’s agree to call it a star. If you observe the first statement, it should be clear that we assign the value of 39 to the variable "index". This is no surprise, we have been doing it for several programs now. The next statement however, says to assign to "pt1" a strange looking value, namely the variable "index" with an ampersand in front of it. In this example, pt1 and pt2 are pointers, and the variable "index" is a simple variable. Now we have problem. We need to
learn how to use pointers in a program, but to do so requires that first we define the means of using the pointers in the program.
The following two rules will be somewhat confusing to you at first but we need to state the definitions before we can use them. Take your time, and the whole thing will clear up very quickly.

