r/AskProgramming • u/Cartman1994 • Oct 01 '26
Should I learn C or Rust?
I’ve been working as a Java programmer for a few years now.
The thing is, I’d like to learn a second programming language for lower-level tasks—specifically, I want to work on things related to operating systems. Rather than building one from scratch, I’d like to explore and modify open-source operating systems like Linux or a BSD variant.
I’m doing this purely as a hobby. What drew me to C is its simplicity (though not necessarily ease of use) compared to Java or other modern languages, and its long history of use in systems programming. On the other hand, however, there are operating systems (or components of them) being rewritten in Rust—such as GNU coreutils or the adoption of Rust in the Linux kernel.
So, would it be more useful in the long run to learn Rust, given that it might sooner or later become the standard for writing operating systems?
Thanks.
View all comments
1
u/marrsd Oct 02 '26
I'd probably go with C first because it will introduce you to the memory management issues that motivated the development of Rust in the first place. C also encourages you to think about how you want to manage memory, rather than just leaning on existing language features and idioms.
Rust is still worth learning, though. It brings together a lot of the best features of modern language design in a language that is quite pleasant to use for application development. I'd also look at some of the patches contributed to the Linux Kernel to see how it's also used for systems programming. I think all of the patches I've seen have made heavy use of unsafe code, and it's insightful to see how unsafe code is programmed for the kernel in Rust.