Answers questions on pointers

  1. Which are int variables and which are pointers to ints in the following declaration?
    int * a, b, c, *d;
    
    b and c are int variables; a and d are pointers to int variables.
  2. Which variable does ip1 point to at the end of the following code?
    int i, j, *ip1, *ip2;
    
    ip1 = &i;
    ip2 = &j;
    ip1 = ip2;
    
    ip1 points to the same place as ip2, which is the location of int variable j.

Back to the questions.


Back to notes on pointers.