The Heap and More Flashcards
1
Q
Is the heap outside the call stack?
A
yes
2
Q
How is memory assigned to the heap?
A
By the operating system
3
Q
How can a function access memory from the heap?
A
Using a pointer to it
4
Q
From C’s perspective, a 1-d array is just a :
A
pointer
5
Q
How do we get memory from the heap in C?
A
Alternative to malloc: calloc
Conceptually creates an array of values and sets the memory to be 0.
Format: void *calloc (int array_size, int size_of_one_array_entry)
6
Q
Does space in the heap change dynamically?
A
No, you must change the size as you need to.