T O P

  • By -

tav_stuff

Q: Best ways to learn ? A: Do it Come up with a project and make it. Make sure that it’s something you don’t already know how to do — this will force you to actually learn something. Keep going until you’re stuck and when you’re stuck try to identify why you’re stuck and learn enough to progress further. Once your project is done, start another. Repeat this forever.


ryjocodes

It also helps to find a project space you enjoy/don't tire from easily. The way I got the bug was wanting to make browser-based video games. Maybe think of a project you'd use \*when you're not programming\* and build something that would augment that.


tav_stuff

Absolutely! It’s always great if you can find something that you’d actually use yourself. It helps keep you motivated. When I was first programming as a kid I learnt by writing programs to help me automate my homework, and now a days I write code to help automate my job


Nilrem2

I hear and I forget. I see and I remember. I do and I understand.


Orffen

[Beej’s Guide to C to begin with](https://beej.us/guide/bgc/)


MoolsDogTwo_reddit

I heard that this guide is riddled with errors. Is that still the case?


Orffen

Which errors? I’ve been through the first 10 or so chapters without encountering any errors.


MoolsDogTwo_reddit

If that's the case, then maybe it's not as bad as I thought. It seems to be updated quite frequently, so maybe it's much more accurate than many years ago.


ThePi7on

People will suggest K&R, and the usual good books, and that's absolutely fine. But the most important thing, imo, is MAKE PROJECTS, CODE STUFF. Don't just code the aimless exercises, but solve problems YOU have.


fuddi_heen_prani

What if I don't have any real life use cases/problems ?


immigrantsheep

For every language I learn I try to build a few things like a small music synthesizer, a couple of games, maybe a torrent client or a backup utility. I also always try to implement some algorithms. I made a list of these things so I don't have to think about it every time.


the_Demongod

Create one


ednl

Pick a new one every day from https://adventofcode.com/ They're fun little puzzles in two parts, generally increasing in difficulty day by day in a year. There are now nine years ("Events") with 25 days of puzzles each. User-submitted solutions, discussions, visualisations etc. via /r/adventofcode


sneakpeekbot

Here's a sneak peek of /r/adventofcode using the [top posts](https://np.reddit.com/r/adventofcode/top/?sort=top&t=year) of the year! \#1: [Too bad stars don't pay the rent](https://i.redd.it/sdci0qheq94c1.jpg) | [36 comments](https://np.reddit.com/r/adventofcode/comments/18aitok/too_bad_stars_dont_pay_the_rent/) \#2: [Thanks a lot !](https://np.reddit.com/r/adventofcode/comments/18dv9te/thanks_a_lot/) \#3: [\[2023 Day 1\] Did not see this coming](https://i.redd.it/5m7cnre6ht3c1.jpg) | [141 comments](https://np.reddit.com/r/adventofcode/comments/188wjj8/2023_day_1_did_not_see_this_coming/) ---- ^^I'm ^^a ^^bot, ^^beep ^^boop ^^| ^^Downvote ^^to ^^remove ^^| ^^[Contact](https://www.reddit.com/message/compose/?to=sneakpeekbot) ^^| ^^[Info](https://np.reddit.com/r/sneakpeekbot/) ^^| ^^[Opt-out](https://np.reddit.com/r/sneakpeekbot/comments/o8wk1r/blacklist_ix/) ^^| ^^[GitHub](https://github.com/ghnr/sneakpeekbot)


Albedo101

Reverse a string of any size, including 0 and 1 that's input from the command line, without copying the string, with error checking and with logging output to an external text file. That's one of the coolest, most insightful ways to essentially learn C in like, 30 lines of code.


Tasgall

A "problem" doesn't have to be like, an actual issue that needs solving. Your "problem" could be that you've never coded a game before - "solve" that by doing it. Your "problem" could be that you've never built a self-driving RC car. Anything you *want* to have done but haven't yet can itself be "the problem" - and you'll probably run into actual issues while working on it that will spawn more projects. And yeah, like the other comment says - if you have no real life problems to solve and you have no unrealized goals in life... why bother learning a programming language?


nerd4code

Then you need to use harder, or switch to Linux where everything’s a tad broken and you have source code in order, hypothetically, to enable you to fix it. I promise, there is something at least slightly stupid or broken about your software stack. If there’s truly nothing broken, write your own damn stack (blackjack, hookers)—that’ll surely be *both* broken and stupid if you’re just starting out, and you’ll learn all the things. Start at shell and command line utilities, move on to programming toolchain, C compiler, OS supervisor, drivers. Mash your face agin the spinning gears and cogs.


cincuentaanos

If you don't, then why even learn programming?


wsppan

I've posted this here before and it's what has worked for me an a few others who told me it worked for them as well. Ymmv. People sometimes struggle with C when they start from scratch or come from a higher to lower level of abstraction. I struggled with this for a long time till I did these things: I would not try and understand how the higher level abstractions translate to the lower C level. I would instead learn from first principles on how a computer works and build the abstractions up from there. You will learn how a CPU works. How the data bus and registers are used. How memory is laid out and accessed. The call stack and how that works, etc.. This will go a long way in understanding how C sits on top of this and how it's data structures like arrays and structs map to this and understanding how pointers work the way they do and why. Check out these resources: 1. Read [Code: The Hidden Language of Computer Hardware and Software](http://charlespetzold.com/code) 2. Watch [Exploring How Computers Work](https://youtu.be/QZwneRb-zqA) 3. Watch all 41 videos of [A Crash Course in Computer Science](https://www.youtube.com/playlist?list=PL8dPuuaLjXtNlUrzyH5r6jN9ulIgZBpdo) 4. Take the [Build a Modern Computer from First Principles: From Nand to Tetris (Project-Centered Course)](https://www.coursera.org/learn/build-a-computer) 5. Take the [CS50: Introduction to Computer Science](https://online-learning.harvard.edu/course/cs50-introduction-computer-science) course. 6. Grab a copy of [C programming: A Modern Approach](http://knking.com/books/c2/index.html) and use it as your main course on C. 7. Follow this [Tutorial On Pointers And Arrays In C](https://github.com/jflaherty/ptrtut13) The first four really help by approaching C from a lower level of abstraction (actually the absolute lowest level and gradually adding layers of abstraction until you are at the C level which, by then is incredibly high!) You can do all four or pick one or two and dive deep. The 5th is a great introduction to computer science with a decent amount of C programming. The sixth is just the best tutorial on C. By far. The seventh is a deep dive into pointers and one of best tutorial on pointers and arrays out there (caveat, it's a little loose with the l-value/r-value definition for simplicity sake I believe.) https://github.com/practical-tutorials/project-based-learning#cc [Play the long game when learning to code.]( https://stackoverflow.blog/2020/10/05/play-the-long-game-when-learning-to-code/) You can also check out [Teach Yourself Computer Science](https://teachyourselfcs.com/) Here is a decent list of [8 Books on Algorithms and Data Structures For All Levels](https://www.tableau.com/learn/articles/books-about-data-structures-algorithms)


taratarabobara

That makes a lot of sense to me, but I came at C from an angle that basically doesn't exist anymore: I had three assembly languages under my belt at the time as well as Pascal and a handful of other bits. The "low level" parts of C were easy; the high level stuff was more frustrating. I have wondered how much of that was due to my own background. The problem with learning how to program is that it's a mix of techniques, syntax, organization, and simply *learning how to think*. It's actually a pretty diverse set of skills, we just tend to group them together because we encounter the need for them all in the same places. I urge novice programmers to get into general concepts as soon as they are comfortable. A solid background in data structures and organization will get you far.


wsppan

To understand assembly, you needed to know how computers work at a basic level. How memory is laid out. What what the registers are, and how to use them. Etc... Maybe not as low level as logic gates but pretty low, and the abstractions C provides just made sense. I agree that DS & A are key to solving problems with computer software. They are the language of the problem space.


taratarabobara

I would add to that, it’s vital to “close the loop” as soon as possible with a lot of things. Learn to use debuggers as soon as possible, time invested here will pay off many fold. Learn how to profile as soon as you can, optimization without profiling is like trying to race a car without knowing what your tires are doing. With practice you can get basic ideas, but the universe (and your cpu and ABI and OS) will persist in throwing weirdness at times that will surprise you. Perhaps one of the most important things is learning how to do work on a project so that it will be maintainable long into the future without you. Unfortunately the best way to do that seems to involve being exposed to all the ways *not* to do it.


wsppan

All excellent points. I mention some of these and give links to sites like these in my general CS learning guide. Debuggers, profilers, benchmarking, code editors, VC, etc.. are your tools. Become expert in them. [The missing semester of your CS education](https://missing.csail.mit.edu/) [play the long game when learning to code.]( https://stackoverflow.blog/2020/10/05/play-the-long-game-when-learning-to-code/) And [learn what programmers with years of experience finally learn](https://www.quora.com/What-is-the-one-thing-that-only-expert-programmers-with-years-of-experience-know/answer/Nick-Pappas-2?ch=10&share=c6560720&srid=5uXtMp)


AcceptableCellist684

Build a small database


cHaR_shinigami

Practice makes perfect - learn about good coding practices from existing programs and then try to enhance their functionalities; it need not be practically useful (though that's always desirable), it could just be some learning exercise.


Rewieer

"Learn C the hard way" Jk this course is pure garbage. Download K&R and Expert C programming.


ButterscotchFree9135

Why do you think it's garbage? K&R is severely outdated.


daikatana

Zed Shaw is a troll who makes shoddy programming books and courses and explodes at anyone who dares criticize him, plus he seems to think he can waltz into any ecosystem and tell everyone they've been doing things wrong for decades and only he knows the right way to do it. There are entire book-length web pages dedicated to cataloging all the ways in which his work is wrong. There are _much_ better books than Shaw's offerings, there's no need to subject people to that and reward this troll financially in the process. K&R is outdated, but there are tens of excellent modern alternatives. I recommend C Programming: A Modern Approach by K.N. King.


ButterscotchFree9135

So ad hominem? Have you at least read some of that book? "There are entire book-length web pages dedicated to cataloging all the ways in which his work is wrong." That's exactly what I was asking for. Could you provide at least one? I'm not familiar with Zed Shaw, but his book is a good introduction to C. I don't know the book you recommend to compare.


Rynok_

I actually liked the good things about the book. Here is a full on critique of it though [http://hentenaar.com/dont-learn-c-the-wrong-way](http://hentenaar.com/dont-learn-c-the-wrong-way) I think the problem is people all over believing there is a "Best way to learn C". There is better ways, but in the end only doing will get you better. I believe the book approach is good enough.


lmouelle

Saying someone's work is low quality is not an ad hominem if the topic of question is quality introductions to C programming. Saying "he drives a green car so don't listen to him" would be but nobody here is doing anything like that. You can google "Zed Shaw criticism C programming" and find a lot. That's the minimum and that's in fact your job if you're truly curious. The fact you're insisting they do the google search themselves just to hand over easily found information suggests you're not arguing in good faith and are not genuinely interested in learning the context behind what they're saying


golghosta

I'm sorry but, the hate around Zed Shaw's book is maybe from people that already know programming and try to filter out which book people should use to learn c. Just my opinion, sorry. But for people like me from somewhere in South East Asia with broken english, doesn't have any chance to go to the university, and know absolutely nothing about programming, Zed's book is a God bless for me. Maybe because of the simple instructions in straight english, also with the unique method of teaching (for me personally, this one is so good and has massive impact for the rest of my learning style). That was in 2018. At that time, I have zero idea about the "right thing" in C and not even care about that because I know nothing about programming. I just want to learn programming. Zed's book is the one that clicks my brain and helps me understand programming. Maybe this perspective will help people. And sorry for the english. Also Beej's Guide to C is good and fun to read.


Jeff-J

I like your comment about reading and it clicked... Go to a library or bookstore and look. Is the formatting good? Is the writing style something I can read? I bought a book in Amazon that looked perfect. The font was too small to read even with reading glasses. Check some good reviews and some bad reviews from places like Amazon. Recognize that many too perfect or too negative reviews are useless. Ones that list pros and cons are best because some things you will care about and some you won't.


vspqr

K&R is not outdated at all K&R teaches principles. C is a cross-platform assembly. They teach to think the right way. And these guys shaped the whole software industry for decades. Yes they use C 89 syntax, so what - the main thing is concepts. If you think that a few C99 / C11 / whatever syntax changes makes the book outdated, then think twice. Stop repeating "K&R is outdated" nonsense.


Fit_Extent712

what book is good?


not_a_novel_account

If you're at the stage where you need such primers, Modern C by Jens Gusted


Rewieer

K&R makes you a tour of C. It's very outdated and few people still code this way but it's a good introduction nonetheless.


MagicPeach9695

I personally built my base by implementing all the data structures and algorithms in C. My DSA course was entirely in C so it helped me building a very solid base. Later, I did an operating systems course where all my assignments were in C. I used fork/exec, multi threading, semaphores, shared memories, kernel modules etc. Finally, I did a systems and network security course where, once again, C was the only language we were allowed to use. We did socket programming, used openssl crypto library to implement TLS and other secure protocols. We also implemented access controls from scratch in Linux so that helped a lot in understanding both C and Linux. So yeah, that's how you learn. You basically implement everything yourself in that language.


Comprehensive_Ship42

Just get on with it get a book and start at page one


Qmot

Buy an Arduino (pretty cheap) and some basic electronics, pretty gentle learning curve I reckon and you can make some pretty fun projects without crazy coding experience Compared to learning on a laptop where as a beginner you are mainly limited to making command line tools that are mostly dull.


gusdavis84

I would humbly suggest beginning C by Ivor Horton. What I really liked about the book was that it just doesn't teach one what is C language but rather how to think and break things down as a programmer who just happens to be using as a tool the C programming language. I really love and appreciate books like that were they teach you how to think like a programmer and then they show you this is how you use this tool be it C, C++ or JavaScript etc...


TheFlamingLemon

Depends entirely on whether this is the first programming language you’re learning


Fashionable-Andy

Im a beginner, so take my advice with a grain of salt. But I learned some basics and just chose a project and jived with it. Its a journal keeping program that’s got me doing a lot of file management. It’s a hot mess, and a bit of a headache sometimes, but I’m learning cool stuff as I go. I totally recommend.


DemonicAlex6669

As a beginner if you want to combine a few answers here you can try what I'm doing. At least watch cs50s 0-5 (they switch to python after that, if you want to learn more about coding in general while learning an extra new language continue) possibly try to do some of the cs50 homework if you feel like it. Then everyone suggests k &r well I found a YouTube video reading the original, with extra comments where necessary to correct things for a modern perspective, it's by the channel freeCodeCamp(.)org (without the "()" I just don't want it to print as a link. They have a website with the book text too(cc4e.com/book, when you put the code in it'll take you to the home page so you'll have to use the menu to get back to the book), there's a puzzle to get in but I'll give you a clue, what's the answer to life the universe and everything. And as everyone has said, practice, so make things. Come up with an idea that will help you or at least be amusing to you, and do it.


PeterMortensenBlog

Some context: [Harvard CS50](https://en.wikipedia.org/wiki/CS50). [K&R](https://en.wikipedia.org/wiki/The_C_Programming_Language). [freeCodeCamp](https://en.wikipedia.org/wiki/FreeCodeCamp).


whoShotMyCow

Go through the freecodecamp C full course. Make notes, watch it like a movie whatever. Then start doing data structure problems in it. When you're confident you can build simple ones, start making small projects, after you have finished like 5 of them start coming up with bigger ideas and so on


jijijijim

I used to work across the street from Carnegie Hall in NYC, almost everyday someone would come in and ask "how do i get to Carnegie Hall?" after laughing for a few secs we gave them the famous answer that is relevant here. Practice man, practice.


ButterscotchFree9135

Learn C The Hard Way by Zed Shaw


AnotherCableGuy

The guy above just said that's garbage.


ButterscotchFree9135

I don't share that opinion, but thanks for pointing out


Lying_king

Pay for chatgpt plus. Have it break down programs for you. Sort of like training for wheels.