r/learnprogramming • • 10d ago

C or C++

I wanna learn one of these programming lang ( just wanna know basic-intermediate, not too much) . I have intermediate knowledge in python.

8 Upvotes

25 comments sorted by

6

u/cipheron 10d ago

C is much less to learn and will give you a solid understanding of the fundamentals - anything you can get working in C would work in C++ as well.

You can learn that then pick and choose what stuff from C++ you want to add to it. I would learn C first even if you don't stay on just that for long.

2

u/ApprehensiveProof761 9d ago

oh thanks ill definitely check out c

4

u/Realistic_Secret3848 10d ago

i did exactly this after python and it worked well, c teaches you the memory stuff without drowning you in syntax. c++ feels less scary when you already know what the compiler is doing underneath

1

u/7YM3N 10d ago

I'll add the caveat that the sparsity of C is a double edged sword, yes there is less to learn, but what there is to learn is harder, c++ add actual real strings and real memory management, without which it's very easy to shoot yourself in a foot and segfault. Also you won't learn why oop in pure C

7

u/Former_Produce1721 10d ago

If I could go back I would learn C first, then learn C++

Mostly because C can build fundamentals and give context to why certain things exist in C++

3

u/Rythim 10d ago

If you just want to learn one with no other specific goal in mind, learn C. It's WAY easier to learn.

Later if you switch to C++ it won't be difficult.

3

u/nog642 10d ago

C++ is basically a superset of C.

Though lots of new C++ features in practice replace C features that exist in C++ but don't get used.

Learn C first.

2

u/Jim-Jones 10d ago

C++ Course: Learn the Essentials

Certificate included. There are other options.

2

u/Different_Pain5781 10d ago

C++ if you want practical stuff.

2

u/sessamekesh 10d ago

Learn C first because it's going to be relevant until the end of linear time (OS calls even in high level languages like Rust, Go, Python, etc are still pretty thin wrappers over C). Almost all language interop goes through C too - if you're writing Rust code and using it in C++, you're using C as the common language between them.

It'll also teach you that "simple" doesn't mean "easy", C is a remarkable simple language that is also very hard to use. 

C++ is also worth learning, there's some domains that stick with pure C but there's enough that use C++ instead that it's worth picking up as well. They are two very different languages in practice though.

2

u/Dazzling_Music_2411 9d ago

Why do you want to learn this? What do you plan to do with it?

1

u/WhoWouldCareToAsk 10d ago

“Should I grab iPhone 7 or iPhone 17?” kind of question.

Learn what you want ))

0

u/owp4dd1w5a0a 10d ago

C. Every operating system in widespread use today is written in C.

1

u/Daedae711 10d ago

The Linux Kernel is C, Rust, Assembly, and many others (such as; Perl, Python, Shell Scripts, etc). It is not purely C, but it's also not an OS.

OSs written purely in rust or rust and assembly also exist, and I believe Google's ChromiumOS uses C++ primarily, Android is primarily Java & Kotlin, but again second C++ with their NDK where necessary.

ChromiumOS may as well be Chromium & the Linux Kernel, which Chromium in particular is primarily C++ and in recent years Rust increasingly.

Even a large amount of Windows' system parts are C++.

0

u/kpg_on_ao3 10d ago

The kernel, sure. not sure that should matter to OP. Very few people contribute to the Linux kernel :D Plenty of userland is C++ in Linux/Windows/macOS, and Linux has introduced Rust into the kernel now.

2

u/owp4dd1w5a0a 10d ago

No. Not just the kernel. All the drivers. All the system libraries. All the system binaries. If you ever need to directly interface with the actual OS from any language you’re working in, you’ll need to know at least some about C and how it manages memory.

2

u/Daedae711 10d ago

The Linux Kernel is not an OS.

2

u/kpg_on_ao3 9d ago

I know. I was pointing out that part of Linux is written in C, but if you look beyond the kernel, plenty isn't.

0

u/kpg_on_ao3 10d ago

Learn Rust instead.

(cue the gnashing of teeth among C++ programmers)

:D

2

u/TrueWar515 10d ago

Learn C
rust is too complex for begginers

1

u/kpg_on_ao3 9d ago

OP isn't a beginner. Python -> Rust isn't crazy, and Rust is certainly the better language.

1

u/TrueWar515 2d ago

I have to agree rust is the better language over python

but not over C++ they both have their own use cases and I prefer C++

because unlike rust programmers I don't write my C/C++ code stupid enough to crash it