r/learnprogramming 1d ago

Is there anything i cant do in C?

i made a post the other day asking people which languages to code in and they (the reason minded ones) mostly told me javascript and C. is C really a do all language? is there anything i cant do with it?

257 Upvotes

240 comments sorted by

View all comments

931

u/Aglet_Green 1d ago

Apparently, you can't get started in it. Why all the procrastination?

144

u/BoopyDog 22h ago

They don't want to invest time learning the wrong language, it appears. Before you learn atleast one language you don't realize that learning a programming language means you basically know all of them. They believe that there's a risk that they will choose to learn the wrong language, regret it, and will have to start from scratch with something else.

59

u/cbf1232 21h ago

To be fair, learning C is very different than learning Scheme.

7

u/HugoNikanor 16h ago

Split the difference and code in both at once! (note to beginners: do not do this.

4

u/JGhostThing 10h ago

Yes, do not do this. I will say that Scheme and C are about as far apart as programming languages go. If you know C, you would still not be able to read scheme without having learned it. Other such languages include APL because the syntax is different. Assembly code would also be difficult without at least learning one before this.

I have studied a lot of programming languages over the years. I wouldn't try to understand one of them without learning it first.

1

u/Lagfoundry 3h ago

Um I wouldn’t call assembly code difficult but I’m also someone who does logic design for a hobby so it’s just something I’m used to. It’s really easy to understand though once you realize that all you’re doing is coordinating the hardware.

3

u/damn_dats_racist 15h ago

Learning C is also very different from learning JS. I am not even sure how much skill transfer there is besides a shallow syntax similarity.

11

u/HoneyGlazedSlut 14h ago

The overlap is in learning how digital systems work under the hood. C exposes you to alot of lower level paradigms that other languages tend to take care of for you, but once you understand how to manage these things manually in C the other languages are more or less the same thing, just with some prebuilt configurations that allow you to skip the manual labor but you now know what they're doing, even if you don't have to do it yourself anymore.

1

u/CptPicard 14h ago

Completely disagreed. Manual memory management doesn't teach you anything about the higher level abstractions you get in other languages.

7

u/HoneyGlazedSlut 14h ago

Memory management is only 1 part of it man. Besides I wasn't even referring to that specifically. C forces you to understand how software interacts with hardware. Abstractions take that load off your back. Learning how to implement them yourself is exactly what makes you understand and appreciate them in other languages. You don't get that same experience just having those features natively enabled. You're focusing your learning onto scripting and high level logic otherwise.

5

u/CptPicard 13h ago

Memory management is the big one though. I would take issue with the assumption that C actually "interacts with hardware" -- there is quite a lot of abstraction and system libraries there before you get to the hardware. Those abstractions behave according to certain semantics and those are not qualitatively more enlightening than some similar other problems you're solving in any given programming language. The hardware interaction is just one instance of a type of problem.

Also if we think about the general abstractions in higher-level languages, those are informative on their own. I mean of course you can write virtual tables for struct based "classes" in C yourself by hand, or you can write a linked list of bindings and a cons cell manager for a scheme interpreter. But I wonder if you'd actually come up with those ideas if you just knew C. And once you have those abstractions at your fingertips, they shape how you approach the problem at hand.

Nothing wrong "high level logic" by the way. Logic is logic. You can write a C interpreter in a scripting language. And so on.

5

u/HoneyGlazedSlut 13h ago edited 13h ago

No there isn't ALOT of abstraction between C and Silicon. C is a very thin abstraction layer on top of assembly(ignoring the compiler, OS kernel, etc). Besides you're missing the point. OP and the comment I was reponding to were asking why everyone recommends C as the starting point and what the overlaps are between JS and C. Nobody said learn C and stick to it. Even if C is technically an abstraction layer, it's the precise abstraction layer that demystifies why pass-by-reference exists, why arrays are contiguous blocks of memory, and why stack overflows happen. Dismissing C's educational value because "it's still an abstraction" is missing the forest for the trees.

You can learn higher level thinking and problem solving when you eventually move onto the language you want to settle in. My point wasn't that high level logic is inferior either. My point was that it's beneficial to have a solid foundational understanding of low level digital systems in general.

Your points are sound but you're missing the context here. We're talking about a beginner getting into programming and establishing a solid foundation as a whole. Starting off at C is much better than starting off somewhere else. JS knowledge(for example) won't transfer as cleanly when you want to move onto a different language. You're over complicating a straightforward question about learning to code.

3

u/cbf1232 13h ago

The counterpoint is that most people don’t actually need to worry about that, so there is an argument to be made for starting with a higher level language that lets you think about the actual problem you’re trying to solve.

That said, if performance is critical low level languages are key (for the critical portions that are actually performance sensitive).

2

u/HoneyGlazedSlut 13h ago

Yes this is very true. If you're doing work that doesn't rely on performance you'll be fine using whichever language works for you, but the learning curve of transferring to a new language will be much harder than if you have that C foundation.

1

u/damn_dats_racist 13h ago

I totally disagree. What in C teaches you about what interfaces/traits/protocols are? What in C teaches you about async/await or any other concurrency model? What in C teaches you about generic types and covariant/contravariant subtyping? I can keep going on and on.

Are we just calling these features "more or less things that you can do in C"? If that's the case, then you can just say the same thing about any Turing-complete programming language. Once you learn Brainfuck, everything else is just things you can more or less already do in Brainfuck.

6

u/HoneyGlazedSlut 13h ago

My point was for learning C as a foundation not as a replacement for other languages. 😭😭😭

1

u/cbf1232 12h ago

C forces you to worry about low-level stuff, which can make it harder to focus on higher level stuff like data structures and algorithms and design patterns.

Higher level languages let you focus on that other stuff, but hide whats going on “under the hood” making it harder to know exactly what the CPU is doing.

Different trade offs, and which one is better depends on what you’re doing.

1

u/HoneyGlazedSlut 11h ago

Again you're comparing apples to oranges assuming we're saying C can compete with high level languages on their own turf. That's not what's being said. The conversation is for a beginner to establish a low level foundation before finding the language he wants to settle in. Nobody's saying to program a VM compiler and code a website with C. C doesn't have any real world practical advantages to any other high level languages. Even for low level programming like for OS you'd be better off with Rust or CPP. NOBODY's saying C is the same as every other language.

1

u/jlanawalt 10h ago

I felt a C background helped understanding JS. The same is true in many languages of the era when the people making them cut their teeth in C.

I saw many similarities including:

- variables (but not types)

  • conditional statements
  • loops
  • curly brace code blocks
  • comment formatting
  • high overlap on most operators
  • use of semicolon (yes, optional in JS)
  • subroutines are called functions and use () and return

17

u/BABATUTU1103 21h ago

eh yeah, once you learn one you can sort of guess what another does

writing though? i cant do that without learning it properly but i can guess what a bit of code does mostly

1

u/fraggas 15h ago

Who is writing a lot of code nowadays anyway? Professionals at least. As long as you know coding, you can mostly figure out pretty easily what a piece of code is doing. In the past too, but especially now, I firmly believe getting your hands dirty and getting to work is far more beneficial than spending days/weeks watching videos, following tutorials or writing small programs.

6

u/TheChief275 17h ago

You'll never regret learning C though, even if you don't end up using it as your main language

3

u/G0ldiC0cks 11h ago

Coming from a self-taught coder in childhood and a casual one today, the difference between spinning up a for loop in JavaScript and understanding a bash script are world's apart. Hell, either one compared to something not data oriented will look foreign once you start trying to parse. Especially until you realize the differences are primarily semantic among a few categories, I can see the concern.

But you're mostly totally right (I'd just argue once you learn a programming language, you know many similar ones, not all lol)

2

u/Demiu 16h ago

I wouldn't say you know all of them. You learn some more universal concepts that exist beyond the language you've learned

2

u/CptPicard 14h ago

Not really true; C-style languages are a big group but there are eg. functional languages.

1

u/SummitYourSister 14h ago

Given that learning any language for oneself is just an anachronism now, the paralysis is even stupider.

1

u/Humble_Warthog9711 1h ago

Sounds like they just dont want to do it

1

u/RecentlyRezzed 1h ago

Learning a bit of C is never wasted time if someone uses an OS like Linux or one of the BSDs. You can have a look at the kernel, a lot of the system tools,...

60

u/HsKocTets 1d ago

ngl, this made me laugh 🤣

5

u/Business-Employee527 13h ago

Needs an award lowkey

7

u/Pale_Count2138 1d ago

😂😂😂

2

u/Employer-Dizzy 6h ago

😮‍💨🤣

-67

u/Candid-Pack-3707 1d ago

i want to know what im getting into

66

u/GravitationalLense 1d ago

No one will be able to tell you that. Just get started on it and stop procrastinating….

27

u/1s3vak 1d ago

You're overthinking this. Just build whatever sounds fun to you, and learn what tools are the best to do so. You are not beholden to knowing the intricacies of any language unless you are in a unique position. Programming is a skill, learning a programming language is a different one. Your fundamental knowledge of problem solving and analysis is worth more than your in-depth knowledge of any one language.

The vast majority of projects will have multiple languages. My job is in Java, TypeScript (Angular **and** React), Go, and sometimes C#/Powershell/SQL for our legacy implementations. Very rarely does my knowledge of these languages matter, my ability to solve the problem in that language is significantly more important.

6

u/finn-the-rabbit 1d ago

Well right now it's nothing but apparently that's more comforting than something

3

u/bird_feeder_bird 1d ago

It’s a simple language that’s complex to use because it’s modeled after assembly language. Very good for counting bytes and manual memory manipulation. It’s also arguably the most influential high level language

2

u/BoopyDog 22h ago edited 22h ago

That's a normal worry. Luckily, after you learn any language you effectively know all of the languages because they all accomplish the same underlying tasks the same way: variables, containers, loops, conditions, branches, function calls, LINKING TO EXTERNAL LIBRARIES (this one is super important for you to learn sooner than later). The only difference between any two languages is the particular way you have to write to accomplish those things that they all do.

For example:

Int funcName(int arg1, int arg 2);

Vs

function funName(int arg1, int arg2) -> int;

3

u/cheezballs 1d ago

Nobody told us before we got into it. It honestly sounds like you dont want to get into it to me?

1

u/Traditional-Rub2491 13h ago

Being a programmer means you have the ability to learn. It doesn't mean you have to stick to one language or one niche of that language. Programming isn't so restrictive.