Day 10 Recap Questions
  1. What is a pointer?
  2. If a is an int variable, and p is a variable whose type is pointer-to-int, how do you make p point to a?
  3. If p is a pointer-to-int variable that points to an int variable a, how can you access the value of a or assign a value to a without directly referring to a? Show examples of printing the value of a and modifying the value of a, but without directly referring to a.
  4. When calling scanf, why do you need to put a & symbol in front of a variable in which you want scanf to store an input value?
  5. Trace the little program below and determine what the output will be.
int func(float ra[], float x, float *y) {
    ra[0] += 10;
    x *= 20;
    *y += 30;
    return 40;
}
int main() {
    float a = 1;
    float b = 2;
    float c[] = {3, 4, 5, 6};
    int d;
    d = func(c, a, &b);
    printf("%.2f, %.2f, %.2f, %d\n", a, b, c[0], d);
}