Skip to content

Instantly share code, notes, and snippets.

View AbhishekGY's full-sized avatar

Abhishek G Y AbhishekGY

View GitHub Profile
@nicknapoli82
nicknapoli82 / c_memory.org
Last active August 24, 2024 15:17
Everything in c is a pointer!

Everything in C is a pointer!

That’s right. I’m making this statement. This little write-up is an attempt at explaining how any why everything in the c programming language is actually just a pointer. This is simply an attempt at explaining how memory in the computer is arranged in a narrowed view and my real goal is to consider the most simple examples possible.

I will be focusing on x86 specifically.

Types in c (bits and bytes) - and pointers

I would feel pretty confident that you, by now, understand that the types in c are simply identifiers in how much space is used to represent a number. I have no interest in explaining the difference between signed vs unsigned integers. Nor am I going to explain how floating point numbers are represented. If you are interested in those things take a look at these two links. C data types and [[https://en.wikipedia.org/wiki/Floating-point_ari