cs 50 memory lecture Flashcards
what is added arbitrarily to the beginning of hex values to signify that it is a hex value?
0x
example:
0x
0xC
what is this value in hexadecimal 10
16
why?
because we count from 0 - f (which is 15) in the first most right value. once we hit the highest value (which is f) we put a 1 next to the right value which signifies the 16th place. like counting in base 10 but instead we use base 16
what is a pointer?
an address in the computer’s memory
what is a string when thinking about it in terms of memory in c
it is a pointer to the first character. the rest of the characters will follow that address
when you print a string to the screen, how does the computer know where to stop in memory?
each string has a null terminating character at the end of it in memory. when the computer sees that null terminating string it stops.
/0 is added to every string to show that the memory address ends with the null terminating character
How is memory organized physically? where is the machine code, globals, heap and stack
machine code globals heap (chunk of memory you can allocate from) ↓ ↑ stack (runs your functions)