*pa=44 *pb=66 a=66 b=66
#include <stdio.h>
int main( void )
{
int a = 44 ;
int b = 66 ;
int *pa, *pb ;
pa = &a ;
pb = &b ;
printf("*pa=%d *pb=%d\n", *pa, *pb );
*pa = *pb ;
printf("a=%d b=%d\n", a, b );
return 0;
}
The statement *pa = *pb is performed in two steps
(as are all assignment statements):
Step 1: The expression on the right of the=is evaluated.*pbevaluates to 66.
Step 2: The expression on the left of the=determines where to put the 66. The*pasays to follow the pointer inpa, so the 66 is put in the variablea, replacing what was there.