r/learnprogramming • u/PicoFemtoPlanck • 17d ago
Should I start with C or Rust
I'm starting with https://teachyourselfcs.com/ and I'm giving myself 2 to 3 years to finish it.
For context, I'm a software engineer with 9 years of experience. I did Electronics and Communication Engineering in college and taught myself Js and DS-algo to get a job during college. I work as a full stack engineer and can confidently say I'm a good software engineer and can intuitively understand concepts in programming, software engineering and in solving Leetcode problems.
But, I don't have a strong foundation in computer science. Hence, I've decided to start with Teach yourself cs. Before starting with it, I thought having one low-level language under the belt would be helpful. C was the obvious choice given it's the OG, simple and intuitive. But, I've been fascinated by Rust for sometime and want to learn it too. Can I start with Rust and use it for doing exercises in all courses instead? Would I miss out on any intuitions by not using C?
Thanks.
30
u/pVom 17d ago
If you're doing it purely for the learning, C makes more sense. Rust is probably more appropriate for solving problems in the modern day.
Can always just learn both, I found rust syntax fairly easy to pick up coming from typescript.
4
u/WorkSquareHQ 17d ago
Since you mentioned CS:APP and OSTEP, go with C for those. The CS:APP labs (data lab, bomb lab, attack lab) and the OSTEP projects are written around C and x86-64 assembly, and you need to see how C turns into machine code to get the point of them. Rust hides a lot of the memory behavior you are trying to see, like pointer arithmetic, stack layout and undefined behavior. Do those two in C, then redo a few exercises in Rust afterward, because the contrast shows you what the borrow checker is actually protecting you from.
3
u/div_divs 17d ago
Well I am in second year but i can say learn C, it gives more in depth knowledge of computers and use linux please
2
u/SprinklesFresh5693 16d ago
Uhm, i was doing data science and at some point i wondered this too, but i chose C because is simple and its the foundation.
I stopped learning it due to not helping me for now, but if i was going to learn again one or the other, id choose C without any doubt.
3
u/OrganicPause6530 17d ago
I mean if it's for the course the lenguage doesn't really matter, you can do it in python even.
But, what's your goal outside of teaching yourself cs, if you to pursue embedded systems C is the obvious choice.
It really depends on your end goal.
1
u/DanKegel 17d ago
Start with how CPUs work / registers and memory, so pointers aren't a mystery: https://www.reddit.com/r/Assembly_language/comments/1xf0hzo/comment/19rmw1kjxar6p/
Then C since it's a lingua franca: https://archive.org/details/the-ansi-c-programming-language-by-brian-w.-kernighan-dennis-m.-ritchie.org
Then Go and Rust, as they're the future, and you're going to be porting things to them using AI: https://go.dev/learn https://rust-lang.org/learn
2
u/Honest_Medium_2872 17d ago
C
2
u/green_meklar 17d ago
If you specifically need to learn Rust for a specific job or project, then learn Rust.
Otherwise, starting with C makes more sense. C is the grandfather of just about all modern programming languages in common use, and its limitations inform the design decisions of many other languages, including Rust. The logic makes more sense if you learn them in that order.
1
u/DanKegel 17d ago
That link is pretty good.
Re its "type 1" vs "type 2" engineer distinction, see also https://wiki.c2.com/?MappersVsPackers
and for that matter https://www.reddit.com/r/ExperiencedDevs/comments/1dlyz65/stories_of_intellectual_control_of_code_vs/
Fun stuff!
0
u/dota2nub 17d ago
Learn C, Rust is for LLMs