take memory as a rectangle:
mainfunction in C. When then next function called, will have its own chunk of memory. Each block is individually addressed.
C doesn’t have
string type data, it’s the first char’s address of the string in memory, ends with
string s = get_string(); equals with
char *t = get_string();.
t are just the address of first character in memory.
compare two string ?
copy strings, don’t forget to free the memory
swap function to sway ints:
valgrind is another command-line tool for checking memory leaks.
valgrind --leak-check=full ./memory//
./memoryis our commnd
“Stack Overflow” is the term for stack that has grown too large, perhaps if we have a recursive function that calls itself too many times.
“Heap Overflow” is the term for a heap that is too large, perhaps if we called
malloc for large chunks of memory without ever calling
“Buffer Overflow” is the overarching term for when too much data is placed into a finite amount of allocated space.
With a short string less than 12, it will be still ok. But if large than 12, it will overwritten with the address of the beginning of the string, even rewrite the main function:
Each grid is a pixel, since an image has a finite size and thus finite information in it.
255as a standard, to indicate its filetype.
255in decimal is
1111 1111, and
1101 1000. Each of those four bits, since they can hold 16 values, map perfectly to hexadecimal.
255is the same as
216is the same as
d8. And it’s convention to write hexadecimal as
FILE, write into files