- What is a pointer?
- If
ais an int variable, andpis a variable whose type is pointer-to-int, how do you makeppoint toa? - If
pis a pointer-to-int variable that points to anintvariablea, how can you access the value ofaor assign a value toawithout directly referring toa? Show examples of printing the value ofaand modifying the value ofa, but without directly referring toa. - When calling
scanf, why do you need to put a&symbol in front of a variable in which you wantscanfto store an input value? - 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);
}