All Things Low Level
CtrlK
  • Hi 👋
  • Understanding Hello, World!
    • A High Level Overview Of Build Process In C
    • Lets talk about `gcc`
    • A Brief Introduction To ELF
    • A Brief Introduction To Processes In Linux
    • Why main Function Shouldn't Be Of Type `void` ?
    • Macro Level Roadmap
    • C -> Assembly
    • Object Code Analysis
      • `objdump` Perspective
      • `readelf` Perspective
    • Linked ELF Analysis
      • Step 1: Analyzing ELF Headers
      • Full Disassembly
      • Analyzing Section Headers
      • Step 2: Analyzing Program Headers Table
      • Step 3: Interpreter In Action
      • Preparation For Symbol Resolution
      • Why arrays in C follow 0-based indexing?
      • What Are Addends?
      • Relocation - Part 1
      • Global Offset Table
      • Procedure Linkage Table
      • After Relocation
    • What's Next?
  • My First C Project, An ELF Parser & Interpreter
    • Project Design
      • Managing Chaos & Reducing Boilerplate Code
    • Magic Verification API
    • Why A `.c` and `.h` File?
    • Stack Allocated vs Heap Allocated Arrays
  • Low Level Detours
    • Why C Is Statically Typed?
Powered by GitBook
On this page
Edit on GitHub
  1. My First C Project, An ELF Parser & Interpreter

Stack Allocated vs Heap Allocated Arrays

Normal arrays are stack-allocated. Their lifecycle is the lifecycle of the block that contains them. Therefore, they can't be used for returning something. Stack overflow might also happen.

A dynamically allocated array, or a heap-allocated array is accessible until it is manually freed. It is perfect for returning structs.

PreviousWhy A `.c` and `.h` File?NextLow Level Detours

Last updated 3 days ago