lecture4_C_Memory
C Memory
memory alignment(内存对齐)
Memory alignment: a system-dependent rule that tells us where data
can be stored (usually not at every byte)Can be accomplished with the “aligned” attribute
__attribute__((aligned(n)));
Strings
Example: The string “Hi” is stored in memory as an array of characters. This array would look like: {‘H’, ‘i’, ‘\0’}
If the null terminator is missing, C will continue to read memory as if
it was part of the string until it comes across a byte that happens to have value 0.This is a very common source of bugs.
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 LZY的Code生活!