r/cprogramming • • Dec 21 '25
I need help
Recently, I started learning C. What i should learn? Pointers? Malloc and memory things?
10
Upvotes
r/cprogramming • • Dec 21 '25
Recently, I started learning C. What i should learn? Pointers? Malloc and memory things?
2
u/Specific-Housing905 Dec 21 '25
I recommend learning about compiler warnings and debugger as soon as possible. They make your life much easier.
2
u/SmokeMuch7356 Dec 21 '25
How much programming experience do you already have?
If C is your first language (God help you), just focus on the basics - how to drive the compiler, basic program structure (how the code is divided into subroutines, how those subroutines are organized in separate files), control structures (loops and conditional statements), some preprocessor directives, types, and enough of the standard library to do some basic I/O, string processing, and a little math.
Pointers are fundamental to programming in C, so you'll learn about them early on. They aren't difficult to understand, but pointer types and operations aren't always straightforward, and the relationship between arrays and pointers is often poorly explained.
Memory management in C is labor-intensive and error-prone, and you really don't want to start messing with it until you have a better understanding of programming basics.
Be aware that when writing C code, you are the strong link in the chain when it comes to safety and security. C does not do any automatic runtime checks for invalid array or memory accesses, numeric overflow, etc., and it will not throw structured exceptions that you can catch and handle.1 The C philosophy is that the programmer is in the best position to know if such checks are necessary, and is smart enough to write them.
setjmp/longjmp, but it is a world of pain.1
u/[deleted] Dec 21 '25
There is a book from the creator (it’s like a reference book) they tell and show everything there. You take a book - you take a summary and rash
1
u/Rich-Engineer2670 Dec 21 '25
Honestly, learn by doing, not be learning specific concepts -- no book, no video is going to teach the way coding will. Pick some project you already know how to do -- it can be anything. Now try to code it in C. You will run into many walls, and you'll have to learn to solve each one. But that means you'll learn all of those things and how the relate to one another.
1
u/dcpugalaxy Dec 21 '25
Always compile with these flags as a bare minimum:
If you dont know what CFLAGS and LDFLAGS are, they are the arguments you pass to
cc -candccrespectively. If you use a Makefile this happens automatically:There are implicit "suffix" rules that can automatically create x.o from x.c by running
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o x.o x.cand program from your .o files by running$(CC) $(LDFLAGS) -o program a.o b.o c.o. (Where CC is something like cc or gcc or clang or c99 or whatever.)1
u/runningOverA Dec 21 '25
memory types and build system.
1
u/Organic-Author9297 Dec 22 '25
Try DSA with C. and some hacker rank questions.
1
u/ancrcran Dec 23 '25
If it is your first time programming then you take a good book about C (not tutorials) and read it, making the exercises and understanding the examples. If it is not your first programming language then you can start with a project and you will end up needing all the basic features of the language like pointers.
1
u/SirPigari Dec 25 '25
I recommend you the youtube channel low level learning
1
u/shadow9owo Dec 25 '25
Learn the basics of assembly by taking a manual for an architecture and writting something. And then switch to C.
As C is basically just asm++.
Trust me youl learn a lot.
1
u/Key_River7180 Dec 27 '25
C is small, you can grasp the basics in a week. Try to just learn everything at once, it will make everything easier than if you do big breaks.
0
u/[deleted] Dec 21 '25
[deleted] — view deleted comment
0
u/[deleted] Dec 21 '25
[deleted] — view deleted comment
10
u/[deleted] Dec 21 '25
[removed] — view removed comment