Sunday, 20 March 2011

Using Pointers (cont.)


int  int1     = 1036;   /* some data to point to  */
int  int2     = 8;
int *int_ptr1 = &int1;  /* get addresses of data  */
int *int_ptr2 = &int2;
*int_ptr1 = int_ptr2;
*int_ptr1 = int2;

int1 becomes 8
Type check warning:  int_ptr2 is not an int

No comments:

Post a Comment