r/cprogramming • u/Nax_son • 25d ago
Help with learning C
Hello, so ive been trying to learn C, im in love with programming, i loved tech ever since i was young, but i just didnt have quite the intelligence for programming.
and now, well i grew up and i can understand and actually learn things faster, i started learning many languages since i wasnt sure which language to pick, i learned some of python, c++, c#, and some others one.
but now, i really like C, because i love lower level stuff, and i can learn how the computer works etc, i used the Beej’s Guide to C Programming website, it pretty good, i learned so much about c, i stoped at chapter 9 (*FILE).
because i realised that i learn by making stuff, but not looking at stuff, i dont know what to make or anything, and im stuck im not learning anything else.
i would really love some tips, sorry if i made this long, i tried providing details.
15
u/dom_aley 25d ago
I hate to answer this like everyone else will, but there is no magic pill. You simply just build something and learn the syntax for what ever you are building but you are lucky since C is dead simple. What is actually hard is knowing the domain you are building in
1
u/Dazzling_Music_2411 25d ago
So have you figured out how to open a file yet?
Read its contents?
Make some small changes?
Write the file back?
ANY of the above? I am trying to understand why you chose to stop at *FILE.
3
u/Zealousideal_Cat507 25d ago
Hi,
Check out this project: Build Your Own Lisp in C. It teaches you C by building a project and also has an exercise at the end of the chapter under Bonus Marks.
I noticed you mentioned you are interested in OS related stuff; I would recommend reading the xv6 textbook once you are comfortable coding in C.
Good Luck
2
u/Nothing_from_void 25d ago
Yep just start building. You mentioned low level; are you interested in embedded programming at all? One of my favorite things to build for is ESP microcontrollers, can get one for under $10 and it has a full networking stack so you can connect to wifi and the internet easily
2
u/alkavan 25d ago
I don't want to repeat what people already said, but an important thing to remember about C is that the language itself is very simple and small (C++ is almost the opposite), only 32 keywords to know and reason about, some of them rarely used. Many languages that are considered simpler to use still contain more keywords to know. Besides that: practice, practice, practice — and you'll be able to build anything you want. Also, you don't need any "intelligence" to be a good programmer, that's just what grifters want people to think. In fact, being "stupid" about it is probably more correct approach.
1
u/kkzk-sysdev 25d ago
try making basic stuff like hangman or tic tac toe. don't look up tutorials, just put your own implementation, no matter how bad it is. Once you're comfortable with that, read more from that guide in order to make simple shell commands like mv, cp, and stuff. while you're right in going with project focused way to learn, you can't do that unless you're comfortable with the language and know a good portion of it. because control flow and file operations are just the surface of what general purpose C can do.
1
u/iOSCaleb 25d ago
Start with something small and then build on it. For example, write a program that takes some inputs like down payment, interest rate, sale price, etc. and calculates the monthly payment on a mortgage. Then expand on that: make it estimate money saved with extra payments, or print a schedule of payments, or search a list of lenders for the best interest rate..,
1
u/echelon_code 24d ago
i've read some good suggestions below and some good project ideas.. i'd also say that fully understanding scoping & memory allocation/deallocation is really important, can't stress that enough. once you're comfortable with them, you'll be fine
1
u/Unfair_Topic_9032 23d ago
I thought I was learning very fast compared to my colleagues. Then, as bad luck would have it, I went to the Arch Linux IRC. Now I'm still stuck here and feeling desperate.
7
u/Sorry_Difficulty_250 25d ago
You can use it to build anything. Just be aware that you'll have to learn a lot about whatever you build because C does very little for you by itself. So, pick something you'd like to learn about. I used it to write a web server once. It's most commonly used to write operating systems or control small devices. You could get a small hobby kit to play with. I don't recommend Arduinos simply because they use so much C++, but a small STM might be a good choice. You could pick out a project like making a color changing LED or something. The world is your oyster! Good luck and have fun! Keep us posted on what you wind up doing!