1. Think of & as an address.
2. Think of * as a star referring to stored
Assume for the moment that "pt1" and "pt2" are pointers (we will seehowto define them shortly). As pointers, they do not contain a variable value but an address of a variable and can be used to point to a variable. Line six of the program assigns the pointer "pt1" to point to the variable we have already defined as "index" to "pt1". Since we have a pointer to "index", we can manipulate the value of "index" by using either the variable name itself, or the pointer.
Line nine modifies the value by using the pointer. Since the pointer "pt1" points to the variable "index", then putting a star in front of the pointer name refers to the memory location to which it is pointing. Line nine therefore assigns to "index" the value of 13. Anyplace in the program where it is permissible to use the variable name "index", it is also permissible to use the name "*pt1" since they are identical in meaning until the pointer is reassigned to some other variable.
2. Think of * as a star referring to stored
Assume for the moment that "pt1" and "pt2" are pointers (we will seehowto define them shortly). As pointers, they do not contain a variable value but an address of a variable and can be used to point to a variable. Line six of the program assigns the pointer "pt1" to point to the variable we have already defined as "index" to "pt1". Since we have a pointer to "index", we can manipulate the value of "index" by using either the variable name itself, or the pointer.
Line nine modifies the value by using the pointer. Since the pointer "pt1" points to the variable "index", then putting a star in front of the pointer name refers to the memory location to which it is pointing. Line nine therefore assigns to "index" the value of 13. Anyplace in the program where it is permissible to use the variable name "index", it is also permissible to use the name "*pt1" since they are identical in meaning until the pointer is reassigned to some other variable.