?
2012-04-14 18:37:53 UTC
int n;
int *a;
int *b;
a = &n;
b = a;
a. The value of n is copied to b.
b. The memory address stored in a is copied into b.
c. The memory address stored in b is copied into a.
d. The pointer a is now pointing to a different object. (I think it's this one)
Given the following declarations, indicate whether each subsequent statement is valid or invalid.
int x;
int *ptr;
a. int *ptr2 = x; (invalid?)
b. &ptr = x; (invalid?)
c. int *ptr2 = ptr; (valid?)
d. int *ptr2 = *ptr; (invalid?)