cs 50 memory lecture Flashcards

1
Q

what is added arbitrarily to the beginning of hex values to signify that it is a hex value?

A

0x
example:
0x
0xC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is this value in hexadecimal 10

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is a pointer?

A

an address in the computer’s memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is a string when thinking about it in terms of memory in c

A

it is a pointer to the first character. the rest of the characters will follow that address

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

when you print a string to the screen, how does the computer know where to stop in memory?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How is memory organized physically? where is the machine code, globals, heap and stack

A
machine code
globals
heap (chunk of memory you can allocate from) 
 ↓
 ↑
stack (runs your functions)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly