Lab 06 - Memory Errors
Last updated
Last updated
Slides:
The optimization using half lies in the fact that it will reduce the size of the stack you use. It will use less memory.
The runtime is the same because at last you still need to visit each element once. (Prove it mathematically later)
Store the -th Padovan Number (0-based index) into . Print out the result is interesting.
Access arrays will consume more time because doing pointer arithmetic takes time.
heap-buffer-overflow
is similar to index
out of bound for fixed-length array.
Cannot free the same memory two times
String is marked using double quotation.
The difference between char *s
and char s[n]
. The first one is stored in the text region and its element is read-only. The second one is a copy of the content stored in the text region that is on the stack.
size_t
is just a fancy way of say a non-negative integer.