Week 3 - Memory Basics, Pointers & Arrays Flashcards
1
Q
What is the output of the following program?
#include int main(){ int a [10]; for (int i = 0; i < 10; i++){ a[i] = i; } int *pa = &a[3]; printf("%ld\n", a[2] * (pa - a)); }
A
6
2
Q
How do you declare an array of 10 pointers to char?
A
char *p[10]
3
Q
What is a pointer?
A
a variable that contains the address of another variable
4
Q
what is &?
A
address operator - gives the address of an object
5
Q
what is *?
A
dereferencing operator - gives the value stored at an address