a=77 *pa=77
#include <stdio.h>
int main( void )
{
int a ;
int *pa ;
a = 77 ;
pa = &a ;
printf("a=%d *pa=%d\n", a, *pa );
return 0;
}
The variable a is declared to be
an integer variable.
The variable pa
is declared to potentially hold a pointer to an integer.
But declaring the variable does not put any value in it.
The name of the second variable does not include the asterisk; its name is pa
The variable a is assigned the value 77.
Then pa is assigned the address of a.
(Another way to say this is that pa is
assigned a pointer to a.)
In the printf() statement,
the first value printed comes directly from
a.
The second value is found by following the pointer in pa.
(Another way to say this is that pa is
dereferenced.)