r/C_Programming • u/Wasabi-spicy00 • Aug 19 '26
Need explanations. I learn how to build simple CRUD app with C# and TS. I wanna really understand CS. So I tried to learn C but I get even more confused about many CS concepts.
I’m trying to learn C not just because I want to learn another programming language, but because I want to understand Computer Science and how computers actually work underneath the abstractions.
The problem is that I constantly fall into an endless chain of prerequisites/CS concepts
For example, I want to understand pointers:
int x = 10;
int *p = &x;On the guide/website it says
ointer is a variable that store memory address.
Okay, but then I ask:
What exactly is a memory address
- address is where numbers telling where data is stored
What exactly is memory?
- memory is where address live
Is memory the physical RAM?
- etc... something with CPU
What exactly is RAM and CPU?
- etc...
How does RAM actually work?
- etcc..
- What's the relationship between RAM, CPU, cache, virtual memory, thread, processing etc.?
And suddenly I'm 10 levels deep into computer architecture instead of learning pointers "*"😂
So what to do here, I wanna understand CS. I thought my experience with coding CRUD APP with C#, but no it doesn't help much
2
u/DrShocker Aug 19 '26
Try writing a CHIP-8 emulator in any language. It's relatively simple as far as emulators go, but teaches enough about what a computer "really" does that you'll have touched most of basic versions of your questions yourself.
2
u/Zerf2k2 Aug 19 '26
Read this: https://people.freebsd.org/~lstewart/articles/cpumemory.pdf
2
u/Tack1234 Aug 19 '26
Having these questions and diving deeper and deeper is actually a great thing. It shows you are really interested in the topic, which means you are striving for knowledge. AI is quite helpful for asking it exactly these questions and having it explain it to you in simple terms. And once you have these basic answers, you can look at books or videos going into the details. And then, of course, practice, practice and more practice writing stuff and debugging it yourself.
2
u/SmokeMuch7356 Aug 19 '26
Computer Science is a branch of Mathematics, meaning it's abstractions all the way down.
To understand what the CPU and RAM and other things are and how they interact, you'll need to read up on digital logic and computer architecture. You'll also want to learn at least some basic electronics (current, voltage, resistance, electrical components like transistors, capacitors, diodes, and integrated circuits).
You don't have to understand the nitty-gritty details of physical RAM to understand what a pointer is - it's just the location of an object or function in a running program's execution environment (another abstraction). It may correspond to a physical address on a specific RAM chip, but more often than not it will be a virtual address that will get mapped onto a physical address by various subsystems (operating system, memory controller, etc.). But none of that really matters as far as your code is concerned.
9
u/mikeblas Aug 19 '26
To learn, you must expend effort. There is no royal road to learning.
I guess you're using AI, since you're reciting questions you asked and the answers you received. But you gloss over the answers: I'm sure they were more detailed than what you represent here. Spend the time to read the answers. Actually read them, critically and actively, until you understand them. If you don't understand them, ask questions until you do -- but you'll have to do the same active reading work with those answers, too.
If you put in the effort, you'll find a way to come to understand it.
There plenty of tutorials on C and computer system architecture online. I'm sure that you can find one that has an explanation that resonates with you. This sub's Wiki has plenty of resources.
3
u/CounterSilly3999 Aug 19 '26
It is good to dig deep, but not allways necessary. If you are learning programming, you could stop at the abstraction level, saying, that memory is a collection of sequential cells, able to store numbers. The cell order number is an address. Which itself could be stored in another cell as well.
2
u/TheEveryman86 Aug 19 '26
CS is full of abstractions. If you want to learn the pointers abstraction you'll need to understand that it sits in a framework of other abstractions that you won't learn all at once. Accept the memory address abstraction without going down the rabbit hole of how the voltages represent one's and zeros in volatile memory.
1
u/torsten_dev Aug 19 '26
Computer Science like every scientific field is deep..
Abstractions all the way down. You can explore the field however you like. Breadth or depth first, bottom up or top down, or better yet all of the above.
Pointers didn't really click for me until after a lecture on Hardware architecture followed by a 4 day x86 assembly workshop. Ymmv
1
u/McDonaldsWi-Fi Aug 20 '26 edited Aug 20 '26
It sounds silly but learning Z80/6502 assembly is what really made pointers click for me. They are very simple languages compared to x86 but the fundamental concepts are the same.
In this scenario HL doesn't hold the data we want, it holds the ADDRESS that holds the data we want. So when we say
ld a, (hl), you are loading the DATA stored at the ADDRESS HL is holding.This is what pointers are. They just hold an address. When you "dereference" a pointer you are just grabbing the data stored at that address (or starting at that address).
Very simply put, you can think of memory as a giant shelf with cubby holes. Each cubby hole represents a byte of data, and each cubby hole has a unique number. Your pointer is just the cubby hole number, to get what's inside the cubby hole you have to "dereference" the number (which is a fancy way of saying "go look inside that specific cubby to grab what's inside")