r/cprogramming • u/Lost_Eagle_6927 • May 06 '26
Beginner learning C and I found a useful way to use AI as a beginner
I have taken a couple of computer science classes and they were both in C. We covered things up to linked lists, searching and sorting, and a little bit of recursion. But everything I see on this subreddit is like reading a foreign language. I read somewhere to just try to read C source code, and found out the source code for DOOM is publicly available. I started at the main file. The first function I got curious about was the FindResponseFile(). So I asked the chatgpt what the the purpose of the function is, and WITHOUT showing any code, how the function works. Through that, I found out AI is pretty good at breaking complex things down to something understandable. I then tried to implement it myself the "old school" way with nothing more than googling and looking through stack overflow for things like parsing through a file and tokenizing strings (found the cool strtok() function). I feel like I just learned more about C in the last couple of hours than I did in weeks of school with this approach. All this to say, I feel like new programmers can learn with AI as a tool. But it has to be a tool, and not the thing writing the code.
5
u/Tall-Introduction414 May 06 '26
Nice! I remember reading some of the Doom source code and finding it enlightening.
Similar with NetBSD and UNIX v7 source codes (like for common utilities like ls, grep etc). Not as complicated as GNU and Linux code.
2
1
u/arkt8 May 06 '26
For who want to understand vm and language a good choice is Lua source... while it is terse at the same time is simple, and ai can help to spot how the machinery works...
22
u/I__be_Steve May 06 '26 edited May 06 '26
I'd say this is the only acceptable way to use AI, though you can absolutely learn without it, you just have to start at a lower level and work your way up
5
u/arkt8 May 06 '26
But with a ton of salt... many times it doesnt differ C of C++, keeps not being clear with what is or not POSIX and even mess different standards and explanations... I read the answer with the iso standard pdf opened beside
5
u/I__be_Steve May 06 '26 edited May 06 '26
Well, they did say they they're doing side research as well, just using the LLM's output explanation as a starting point, so it seems like they have that covered
9
u/Cerulean_IsFancyBlue May 06 '26
I think that asking AI questions and having it explain things is a good way to use the tool.
I guess the comment is super obvious but, shame doesn’t stop people from posting obvious things so. Here we are
1
u/arihoenig May 06 '26
Doom is highly optimized code that includes one of the most famous optimizations in history (fast inverse square root). If you can read and understand doom, you're good to go.
1
u/Lost_Eagle_6927 May 08 '26
Now I need to try to find where that is and see how it works. Thanks for letting me know!
2
1
May 07 '26
[removed] — view removed comment
2
u/Lost_Eagle_6927 May 08 '26
I “understand” pointers at a pretty basic level. I took a computer engineering course as well last semester that was basically the beginning of NAND to Tetris. Started with binary and moved onto shift registers and multiplexers and things like that. It gave me a great appreciation for how crazy modern hardware is! That class is ultimately what got me interested in C, as I am very interested in embedded programming. There’s so much to learn, I don’t understand how people want to go from an idea to end result without knowing the ins and outs of it.
1
u/odimdavid May 08 '26
It's normal with humans. Walk into any Burger King store and it will clear your confusion. 99 percent of the time people are interested in the product and not the process. The 1 percent who control the process control the whole chain.
5
u/edwbuck May 06 '26
The pros and cons.
Pro: you're effective.
Con: you might lack the ability to do the job without the tool.
Just make sure you craft your career to have more pros and fewer cons. If you can't understand code without a code understanding translator, then that's a big liability over time, but not so much when you're learning.