The heap
hic 1
The heap hic 1 Limitations of the stack int *table_of(int num, - - PowerPoint PPT Presentation
The heap hic 1 Limitations of the stack int *table_of(int num, int len) { int table[len+1]; for (int i=0; i <= len; i++) { table[i] = i*num; } return table; /* an int[] can be used as an int* */ } What happens if we call the function
hic 1
hic 2
hic 3
hic 4
hic 5
hic 6
hic 7
hic 8
hic 9
hic 10
hic 11
hic 12
hic 13
hic 14
hic 15
hic 16
hic 17
hic 18
hic 19
hic 20
hic 21
connections-for-almost-1000-sites] [https://filippo.io/Ticketbleed]
hic 22
hic 23
hic 25
(but unlikely for this non- recursive code)
hic 27
hic 28
hic 29
hic 30
hic 31
hic 32
hic 33
initially 1 malloc 4 more malloc’s 2 free’s 2 more malloc’s
hic 34
hic 35
hic 36
hic 37
hic 38
hic 39