Autosave: 2024-04-20 14:50:05

This commit is contained in:
thomasabishop 2024-04-20 14:50:05 +01:00
parent c21e92a1b6
commit aab8552487
3 changed files with 19 additions and 2 deletions

Binary file not shown.

12
zk/Bitwise_operators.md Normal file
View file

@ -0,0 +1,12 @@
---
id: t127
title: Bitwise_operators
tags: []
created: Saturday, April 20, 2024
---
# Bitwise_operators
## Related notes

View file

@ -20,6 +20,10 @@ _garbage collection_. In a language like C, this is the explicit concern of the
programmer and is not abstracted away. Failure to properly manage garbage programmer and is not abstracted away. Failure to properly manage garbage
collection is what causes [[Memory_leaks]]. collection is what causes [[Memory_leaks]].
Heap memory is used in combination with the stack since a given heap memory
allocation address is stored as a stack variable during runtime. It points to
the heap memory address whilst not being that memory itself.
Here is an example of managing heap memory allocation in C: Here is an example of managing heap memory allocation in C:
```c ```c
@ -30,7 +34,8 @@ data = malloc(512)
The first line assigns a special _pointer_ variable (indicated by `void *` The first line assigns a special _pointer_ variable (indicated by `void *`
rather than `int` or `str`) . This is a variable only holds a memory address. rather than `int` or `str`) . This is a variable only holds a memory address.
The `malloc` method requests 512 bytes that it wants to assign to the `data` The `malloc` method requests 512 bytes that it wants to assign to the `data`
variable. it will return the address of the first byte in the newly allocated variable. It will return the address of the first byte in the newly allocated
memory. memory. `data` will then refer to the address on the stack that holds the
address allocation on the heap.
## Related notes ## Related notes