⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’

Excalidraw Data

Text Elements

include <stdio.h> #include <stdlib.h>

int main() { int a; // goes on stack

int* p;

p = (int*)malloc(sizeof(int)); // allocated in heap
*p = 10;

p = (int*)malloc(sizeof(int));
*p = 20;

free(p);

p = (int*)malloc(20 * sizeof(int)); //int array of size 20
p[0] = 5;
p[1] = 10;
// etc...

return 0;

}

Heap

Stack

main()

a

Heap

Stack

main()

a

p

10

50

Heap

Stack

main()

a

p

10

50

20

555

Heap

Stack

main()

a

10

50

Heap

Stack

main()

a

10

50

p

996