#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
// display v1 by v1 self
printf("v1 = %d \t\t &v1 = %p\n", v1, &v1);
// the content of pointer
// {%p, pv1} is the address of v1
// {%p, &pv1} is the address of pv1
printf("pv1= %p \t &pv1= %p\n", pv1, &pv1);
// display v1 by pointer
printf("\nusing pointer pv1 to access variable v1.\n");
printf("v1 = %d \t\t in %p \n", *pv1, pv1);
// {%d, *pv1} is the v1 content
// {%p, pv1} is the address of v1
// * to access content, & to access adress
printf("\n");
printf("access v1 address: 1) &v1, 2) pv1(pointer)\n");
printf("access v1 content: 1) v1 , 2) *pv1\n");
printf("access pv1 address: &pv1\n");
system("pause");
return 0;
}