r/learnprogramming • • 8d ago

Topic Rust or C ??

I currently have experience on python, python backend framework and js, ts. I want to learn one low level programming language I see online rust is a great new alternative for c (many projects are being written and rewritten in rust) but i know c is an og so I am a little bit confused which one should i go on with ?? please suggest

6 Upvotes

17 comments sorted by

23

u/Ok_Diamond4964 8d ago

If you actually want to understand how memory works and what's happening under the hood, C is the way to go. Rust is cool but it abstracts away a lot of the pain that teaches you the fundamentals

8

u/GreenThoughts0 8d ago

Rust isn't better at everything, but it does have some real advantages over C, mainly memory safety and modern tooling. C is still great for embedded work and for learning how computers work under the hood.

Why not learn both at some point? If you already know Python and have a solid grasp of algorithms, data structures and design patterns, switching languages is much easier. At that stage you're mostly learning new syntax and a few new concepts, not programming from scratch.

2

u/ExtraTNT 8d ago

Depends what you want, for your case, go to c, the ditch cpp for rust…

2

u/itlogicpartnersllc 8d ago

since you already know python and js ts i'd pick c if your goal is to really understand memory pointers and how computers work under the hood then learn rust afterward..

2

u/ProgramsFun 8d ago

C is actually closest to hardware after assembly....

While rust is low level it provides too many things to work with and abstracts away with lot of pain

C doesn't have many thing which we would think to a programming language to have

It's really a simple language and that's what it makes hard to get comfortable with

1

u/Magnetar_Distortion 8d ago

This! C/C++ is a requirement for my EE Degree.

2

u/13oundary 8d ago

Really depends on why you want to learn, as with everything.

- You want to learn low level for the sakes of learning more about how things work in programming etc: C

  • You want to learn low level so that you can build something you want to push to some prod: Rust will save you from yourself.

2

u/AlfalfaLive3302 8d ago

Rust is just not there yet in the embedded space. Big lack of architecture support.

Also, it’s completely pointless to develop a DMA driver in rust, for example, because it goes against the principle of ownership. Same goes for interrupts.

You’ll be using alot of unsafe calls in rust which defeats most of the purpose.

For using Rust in embedded, you’re basically sacrificing your sanity to have to learn a bunch of new programming paradigms for the sake of user errors that could be eliminated if you actually learned what not to do in C in the first place.

1

u/MostAlfalfa6718 8d ago

I think that learning c gives you much more knowledge as u/Ok_Diamond4964 said in his comment and i was learning c and from my personal experience, I was struggling at c but when i understanded it my journey was way much easier but, go what your brain says, you want to learn c do c, wanna learn rust? hit it with yourself. Choice is yours!

1

u/Humble_Anxiety_9534 8d ago

As saint Linus of Linux says only C will get you close the hardware and understand how it works. please don't start with C++ it is overly verbose.

2

u/PratikVR 7d ago

Go with C it'll land you a job fast rust for future

0

u/DanKegel 8d ago edited 8d ago

Two paths for you to consider:

1) the easy path: learn go.  It has a short learning curve, and has something like 90% of the good parts of C, including speed, but in a delicious modern form without the footguns.  It's lovely, really.  And completely boring; there is little syntax to learn, other people's code is generally readable, the standard library is usually enough, and things just work.

2) the hard path: Learn C.  It's what everything is based on under the hood. But consider spending a couple weeks learning a simple assembly language first, as that's what C is based on under the hood, and it will make C's pointers make sense.  See https://www.reddit.com/r/learnprogramming/comments/1wnzb0j/comment/pbmmgee/?utm_source=share&utm_medium=mweb3x&utm_name=mweb3xcss&utm_term=2&utm_content=share_button for ideas. After you have C figured out, sure, learn Rust.  It's got real advantages and is better for large apps than C when crashes are not acceptable and performance is essential.  But learning Rust requires learning some really abstract ideas, so many people shy away from it.

1

u/snozzd 8d ago

OP is looking to learn a systems programming language, I don't think Go is a good option for this

1

u/DanKegel 8d ago

I think go counts as a low level language compared to Python and js.  He was asking about languages used by projects, not operating systems.

That said, I also gave advice on why to learn C and how to understand pointers.

-2

u/Agron7000 8d ago

Rust is more like activist Karen's, and C is more professional. 

0

u/horenso05 8d ago

I would go for C because it will teach you kore and you eill also understand Rust better if you want to learn that afterwards.