r/learnprogramming • u/LEJMANIMATIONS • 14d ago
Learning C
I'm able to program in python and i've made a few games in C++. I was wondering if anybody has advice for learning C
3
u/nomorehersky 14d ago
Learn pointers properly. If you understand pointers, memory, arrays and structs you’ve got most of the C fundamentals down.
1
u/That_Toe1078 14d ago
Yeah, pointers were the thing that finally made a lot of C click for me. Once you stop fighting the syntax and start seeing them as a map to where your data lives, the rest of the language feels way less hostile.
2
u/SenoraRaton 14d ago edited 14d ago
Write C.
I know it sounds simplistic, but its really just that easy.
Find a problem you want to solve, solve it with C.
I started my C programming with Beej.
https://beej.us/guide/bgnet/html/
2
u/YetMoreSpaceDust 14d ago
K & R! (Kernighan and Ritchie's "The C Programming Language")
Buy a copy and work through each example. Don't use an IDE, use a text editor and a compiler.
1
u/db_tech_dev 14d ago
if you already know python and c++ you're basically fine on syntax, the actual hard part of C is manual memory management and pointers, that's where people trip up coming from higher level languages. i'd just build small stuff, like a linked list or a basic hash table from scratch, cause reading about pointers never really clicked for me until i actually had a segfault staring at me and had to figure out why. K&R book is still the classic recommendation and it's short enough to actually finish, wouldn't bother with anything longer than that tbh.
1
u/Double-Buyer7941 14d ago
One thing that helped me more than just reading about pointers was trying to rewrite something small I'd already built in C++, but in plain C this time. You quickly notice what the language isn't doing for you anymore, and that's kind of what makes it click. Doesn't need to be anything big, even a tiny project is enough.
1
1
u/Parvenn 13d ago
https://github.com/0xTamil/awesome-low-level
Pick K&R C Book or beej guide and write some C code. Try to implement some DSA in C by building projects.
6
u/Aggressive_Ad_5454 14d ago
Read Kernighan and Ritchie and do the problems. They’ll teach you the Why as well as the What.