[圖解C] Example 705: introduce the fundamental concept of pointer (2)

// Example 705: introduce the fundamental concept of pointer (2)
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int v1=1;
    int *pv1;    // set pointer variables by prefix *
 
    pv1 = &v1;    // (no *) pointer variable = (&)variable v1
                  // using & to access the address of variable v1
                  // data deposited in pointer is the address of v1
 
    printf("v1 = %d \t *pv1 = %d\n", v1, *pv1);
    printf("&v1 = %p \t pv1 = %p \t &pv1 = %p\n", &v1, pv1, &pv1);
 
    v1=999;
    printf("\nv1 = 999\n\n");
    printf("v1 = %d \t *pv1 = %d\n", v1, *pv1);
    printf("&v1 = %p \t pv1 = %p \t &pv1 = %p\n", &v1, pv1, &pv1);
    printf("\n");
 
    system("pause");
    return 0;
}