Sunday, 20 March 2011

Using Pointers (continues)


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 = int_ptr2;

Changes happen:
1.Type check warning:  *int_ptr2 is not an int *
2.Changes int_ptr1 – doesn’t change int1

No comments:

Post a Comment