r/learnprogramming • • 2d ago

Learn rust

Could you tell me what the situation is with Rust? Is it worth learning, looking ahead to the next 5 years? Or would it be better to learn C instead?

14 Upvotes

20 comments sorted by

21

u/Joe-Arizona 2d ago

You should learn C then Rust. A week or two tops and you’ll understand it.

Every programmer should know C, even if it’s just a little bit.

3

u/Madeche 1d ago

Yea, most concepts are interchangeable.

I did the opposite and started on Rust, then a lot of things that the compiler enforced really only clicked once I learned more C, and realised the pain of not having any guardrails like that. But with rust and cargo you have a more modern and arguably more approachable framework. A lot of things that are fairly easy in Rust are much longer to do in C

1

u/UhLittleLessDum 12h ago

I've been doing this for 15 years, and I've never written a line of C, and probably never will.

8

u/softmirage82 2d ago

Rust is definitely worth learning, jobs for it are growing and it pays well. but honestly C and Rust aren't really competing for the same spot, learn C first for fundamentals then Rust makes way more sense.

4

u/sessamekesh 2d ago

Rust is great, and you'll definitely pick up some C along the way if you're learning Rust.

I personally think it's really silly to either/or when C is one of the options, C is a stupidly simple language (simple, not easy). If you have your feet under you with Rust, C will take you maybe a weekend or two to pick up. 

I would still start with Rust though. The compiler is actually your friend (... Generally) and it forces you to take on a mindset that will be very useful when you pick up C.

Above all though I'd suggest not becoming a one trick pony with Rust. That way lies sadness.

4

u/baked_salmon 1d ago

I think if you really wanted to be comprehensive, you’d do a touch of C, a touch of C++, and then Rust. It’s hard to appreciate Rust IMO without understanding what motives its design around memory safety and why it’s seen as a C++ successor.

2

u/Kevin_Grant_981_8103 1d ago

Your point about C being simple is fair. It's small enough that you can learn the basics alongside Rust without much pain.

1

u/dmazzoni 1d ago

I basically agree with this take. I don't think it matters which order you learn them in.

Learning C and struggling with memory errors will help make it clear why Rust was invented.

On the flip side, struggling trying to get something in Rust to compile, when you know it's safe, will make you appreciate how simple C is.

In terms of career: even with as fast as Rust is growing, there's 1000x more C code out there than Rust code. Most jobs are in improving existing code, not writing new code from scratch. So the odds that you could have a job that involves writing Rust and never touching C is quite low. Most real-world jobs use multiple languages, and mixing C and Rust is quite common.

2

u/futur3_pr3s3nt 2d ago

Its USP is that it's a systems programming language with memory safety by design, and it seems that many people and organizations (the Linux kernel developer community and Microsoft being two of the highest profile examples) have bought into this. So it looks like it will maintain a foothold in systems programming.

Apart from that domain, everyone and their dog seems to be rewriting anything they can get their hands on in Rust these days, and using it for all kinds of things failry remote from systems programming. That's the hype/fad side that I for one look forward to seeing fade, but that's just C-loving old me.

I think learning C is still a solid choice. It's not going away. Rust won't replace it, and the other proposed 'C killers' (Zig, Hare, ..?) won't either.

2

u/korywithawhy 1d ago

depends why you want to learn it. if it's for yourself, then absolutely, if it's for employment, then c is king, and will probably remain so for the foreseeable future. again, some languages like zig are really good for a lot of things but won't get nearly as much widespread use.

3

u/Blissextus 2d ago

Learn Rust. There is nothing wrong with learning Rust. Rust, like other languages, is just another tool that could potentially solve a software problem. If Rust interests you, learn Rust!

Personally, if you're forward looking 5-years ahead, I'd start with learning the C-Language. C-Language will get you the hands-on knowledge you'll need for low level systems understanding. C-Language is small. Learn it and then if you feel Rust may be the better fit for the software problems you're attempting to solve, learn Rust!

2

u/cyrixlord 2d ago

You can't go with with c. Learn rust on your own time or unless your job may require it

1

u/StewedAngelSkins 1d ago

I don't think there are very many rust jobs that wouldn't also expect you to know C (and probably also C++). However there are plenty of C jobs that don't expect you to know Rust. So if you're talking job prospects you have to plan to learn C at some point. That said, you don't have to learn it right now. If you know neither language you're not going to be employable for several years anyway, so you'll have plenty of time to pick up both.

1

u/Technical_Ideal_5439 18h ago

C is one of the few languages I could write a program from scratch without references, it is that easy once you learn some concepts. Other languages would take be a few hours to get back into them.

1

u/UhLittleLessDum 12h ago

Rust is the future. Just look at all the governments investing in it... it's here to stay for a while.

•

u/girvain 57m ago

I'm starting to see a pattern

1

u/Fit_Day375 1d ago

Learn both.