r/C_Programming • u/emparse • Oct 21 '26
Beginner: Stuck on fundamentals and not knowing how to progress in C.
I have been learning c for more than a week, and the fundamentals feel quite solid to me, I learned and practiced a lot of programs based on loops, if-else, switch statements, variables, some basic structs.
I learned it quite easily coz i know a few other languages like python and c++.
However i dont know how to progress any further now. My final goal is to learn reverse engineering along with assembly which i believe is crucial. In addition none of the tutorials really explain much bout pointers memory addresses all these stuff that just feels complex to me. I tried jacob sorbers beginner c course, but he explained as if i was already supposed to know most of these stuff(kinda). Maybe its just too hard for me to learn through the way jacob sorber is teaching.
Any good recommendations on how to progress further, i saw a few books 'Pointers on C' and 'Understanding and Using Pointers', should i buy them?
What should i do?
6
u/Dangerous_Region1682 Oct 21 '26
If you are not completely comfortable with pointers, as well as how they relate to array indices, then moving forwards is going to be tricky.
Learning C for “more than a week” is quite a short period of time. I’ve been using it for 45 years and I still come across people’s code where I have to think about what they’ve written and why.
The language’s syntax is terse, but how you string that simple syntax together is correspondingly more complex as a result.
If you know C++, picking up a copy of K&R The C Programming Language (ANSI Edition) and working through that is probably a decent way of figuring out the subset of C++ that pure C represents. I learned C from K&R First Edition as that was all there was back then.
1
u/mikeblas Oct 21 '26
It seems strange to know that you "know C++" and that you've "the fundamentals of C are quite solid", but you don't understand pointers.
Any intro to C (or C++) will explain pointers. There are lots of resources in this sub's wiki aimed at beginners, and a couple for understanding pointers, specifically.
3
u/TomB1952 Oct 21 '26
IMO, pointers don't warrant the resource of reading an entire book. They're just a memory address.
On the other hand, if reading a book on pointers enables you to understand them, it will be easily worth it.
I suggest not being too hung up on C. It has an above average learning curve for a procedural language but is simple compared to any object oriented language.
You would do well to focus on understanding C++ structures like templates and OOP methods, than to get into the weeds of C. All of the wildly clever techniques like creating a byte array of ML and assigning a function pointer to it's location, then calling that pointer, are total crap coding. It would not be possible to create something less maintainable. But, it's a wild party trick. lol!
I'm not sure there is a need to learn machine language anymore but, if you do learn it, you will be one of extreme few who know it. That is often valuable. I coded in assembly for about 10 years but haven't used it since about 1990. When I think of making something go really fast, I think C. I've written a couple of linux device drivers but have never reverse engineered object code. There is always source available to template from. Perhaps your experience will be different. And then there is the idea of pursuing your dreams because freedom is the only thing we have in life, such as it is.
Best wishes, emparse.
2
u/Dazzling_Music_2411 Oct 23 '26 edited Oct 23 '26
LOL. How much more that a week? Have you actually read K&R???
It sounds like what you do not understand is the use-cases for pointers. Read the post by u/SmokeMuch7356 (* edited)
Also the suggestion for Algorithms in C is excellent.
1
u/knilfix Oct 21 '26
OP, I'm freshly off school and quite interested in reverse engineering as well. I'd say im okay in c and I'm down taking you through the bits im comfortable in .Im also down to collaborating on DSA with c to help with understanding it
1
u/limitless_grow Oct 22 '26
You need to learn what a CPU and what memory is first. For understanding the latter you need to know what a bit is and how numbers work. Afterwards learn C. But let's try to explain the basics in a very short and simplified form.
A "bit" in the computer is just kind of a switch that can be either on or off or a number 0 or 1. Once you have 2 bits they can have together 4 states:
bit 1 off bit 2 off
bit 1 off bit 2 on
bit 1 on bit 2 off
bit 1 on bit 2 on
Every bit duplicates the number of the possible states of all bits together. 8 bits together have already 256 possible states and are called a byte. The 256 states of a byte can be interpreted as different things e.g. he numbers from 0 to 256, the numbers from -128 to 127 (on bit is used for the sign) or 256 different character values. A "char" in C is nothing but such a byte. Once you are using 2 bytes together than you have 65536 states which is a "short" in C. Using 4 bytes you have already 4294967296 states. 4 byte numbers are called an "int" in C.
The memory in a computer are chips that contain a huge number of bytes where each of the bytes has a unique address for setting or reading the bits in that chip. Those chips are called RAM (random access memory). Once you know the address of a byte you can set it to one of the 256 values or read its current value. A "pointer" is nothing but just the address of a byte (or a sequence of bytes) in that memory and for this nothing but a number. However, also "pointers" are just numbers and usually stored somewhere in the memory as well.
There is a electronic chip in a PC called CPU (Central Processing Unit) or just "processor" that's mainly for reading, changing or storing back all the bytes, numbers or pointers in the RAM. The CPU can add, subtract, multiply or divide numbers of diffent size. For doing this it reads numbers from memory into its incredibly fast internal storage (called CPU registers) or writes them back after the operation was done. However the CPU needs to know what it has to do. For this it has to know its commands. The commands of the CPU are stored as a sequence of bytes in memory as well and the CPU reads them one instruction after the other and executes them. Such commands are e.g. "read byte from position 54764767 into register AL", "add 1 to AL" "store the value of AL in the byte at position 54764767" aso.
The list of such commands are called a "program". Once a program has been loaded into memory and is processed by the CPU it's called a "process". However, the CPU commands itself are just byte sequences and hard to understand for humans. Therefore there are programming languages where you can specify the instructions in a human readable form and special programs called compilers convert those into a program for the processor. One of those human readable languages is C. Beside using C you can also write a program in form of raw CPU instructions one single CPU instruction after the other. You are not using the binary instruction codes ("operation codes", "OP codes' or "CPU instructions") for that but a human readable form of those called "assembler language". However, there is more than just one CPU type and each CPU type has it's own very specific set of registers and available commands and therefore every CPU type requires its very own assembler language. That's why for a reverse enginering you have to learn assembler language first and the usage of a "disassembler" that's a program that converts the raw machine instructions of a program back into a human readable form. There are even some free disassemblers like IDA Pro but you have to learn a lot because the reverse enginering of C and C++ binaries isn't a trivial thing and the binaries of each CPU type, operating system platform and compiler are different ones. 🤔
If you are using an IDE like Microsoft Visual Studio for learning C it can show you the disassembly of your C code and the CPU registers in the debugger. However, the generated instructions depend on the compiler settings and you have to learn the x86 assembler of Intel and AMD CPUs to understand those.
I hope this short explanation helps you to understand a little bit how a computer works and what you are up to and what you have to look for. C is a great language that is just fun to use. However, C programmers are usually working with raw memory where the support of pointers in C is a great help while C++ programmers are dealing with more abstract C++ objects and have to struggle with the endless problems and restrictions of C++.