Lecture4: Memory Flashcards
What are the differences between the Binary system and the Hexadecimal system?
The main difference is that Hexadecimal uses 16 digits to represent things such as text, colo…
instead of only 2 digits in Binary system
What is a pointer?
it is a variable that stores an address in memory, where some other variable might be stored (like an arrow that guides you to another area)
- means
- declares a variable as a pointer
- dereference operator, which goes to an address to get the value stored there
what do s do as a data type?
it is a pointer with the address of the first character which will continuously read the array, character after character till hit \0 or the Null character
what is the Pointer arithmetic?
it is the process of applying mathematical operations to pointers, using them just like numbers (which they are)
malloc is a function which used to
allocate some number of bytes in memory
free is a function which used to
free memory
what are garbage values and when do they appear?
They are unknown values that were in memory, from whatever program was running on our computer before. and they appear when we have no specific values in our program
The 4 sections of the Memory layout
1-machine code
2-globals
3-heap
4-stack
What will happen in the machine code section?
here is where our compiler starts to translate source code into machine code
What will happen in the globals section?
here is where will our program read the global variables that we declared in our code
What will happen in the heap section?
here is an empty area from wheremalloccan get free memory for our program to use.
What will happen in the stack section?
it is used by functions and local variables that we created in our program as they are called, and grows upwards.
scanf is a function which used to
pass in the address in memory where we want a specific part from an input