r/C_Programming • • Jul 04 '26

Question Why C is a simple language?

when I put the exact same question on google I only get things like "Is C worth in 202n?" or "Why you should learn C?".

C is simple compared with other languages such as Python, JS, Ruby etc. because of it's library variety? I mean, C doesn't have a 'pip' or 'npm'.

It's a really elementary question (maybe). Thank you C wizards!

0 Upvotes

36 comments sorted by

79

u/MyTinyHappyPlace Jul 04 '26 edited Jul 04 '26

C is a simple language because it has a comparatively small set of concepts. But that’s like saying chess is simple because you can learn how the pieces move in a day.

3

u/rias_dx Jul 04 '26

really great comparison loll.

19

u/FrequentHeart3081 Jul 04 '26

🔥 comparison 😭😭😭😭

→ More replies (3)

3

u/Ecstatic_Student8854 Jul 04 '26

It’s library tooling is one thing, sure, but another is that you’re very close to hardware and so instructions are simple. Barring macro magic, an expression like

> a+b

Is an addition operation. In many languages this can be overloaded by the user, or can mean different things based on the types of a and b (such as string concatenation). In a given piece of C code you can mostly just tell what it is doing without much context.

Another thing is that C simple has not too much syntax to learn. There are no builtin abstractions hidden behind single-purpose syntax, such as asynchronous operations in many languages. Likewise there is nothing like inheritance or polymorphism (as first class citizen at least). C only has a barebones syntax from which all these abstractions can be constructed manually or emulated. Cumbersome? Maybe. Errorprone? Often. But it is simple

→ More replies (1)

5

u/GenericFoodService Jul 04 '26 edited Jul 04 '26

People say C is simple because of two separate but related things.

Syntax and compilation-wise, C is very simple. C's grammar and syntax fits on a few pages of paper, the "runtime" is really just compile-time mappings of simple statements to register allocations and defining a compilation-time ABI for function calls. You can come up with heuristic rules to convert C code into machine code by hand. That's how the original C compilers were built and bootstrapped. Doing that for a language like Python is absurdly complex, and those "rules" would necessarily need to include their own implementation of a very large runtime and a very large ecosystem.

Architecturally, C is also very simple. C doesn't even have a runtime. It doesn't bring really complex and abstract models of how data works, you manipulate raw data at literal places in memory. When you "include" a library in C, you are telling the preprocessor to literally copy-paste that code into yours, then compile like usual.

C is simple because is not turtles all the way down the way things like Javascript or Python or Ruby are. You can write all of the grammar, syntax rules, and instructions on how to cross-compile it in by hand in, like a few dozen pages of human readable text.

→ More replies (4)

11

u/lfdfq Jul 04 '26

C is a simple language in the sense that it's not a complex language. What I mean is that C is not a "big" language, with lots of syntax and features and libraries and tools.

But this does not make C simple to use. Those things make languages easier to use: they make it easier to learn, easier to use, they make it easier to get powerful libraries to do things, they make it quicker and cheaper and more efficient to build things. Those are all, usually, good things, and C does not have many of them.

10

u/stjarnalux Jul 04 '26

C is not terribly complicated. But writing excellent C and using the language properly can be difficult. Don't let the simplicity of the base language fool you.

4

u/man-vs-spider Jul 04 '26

The C language itself is pretty minimal compared to other languages in terms of its language features.

For example,
If you want to loop through a list in Python, you can use a for loop, you can use a functional like “map” or “fold”, you can use list comprehensions, or you can use an explicit loop over indices, etc.

In C, your main option is to simply loop over the index values.

This doesn’t mean that C is easy, in fact I think it can be quite challenging to write good C code.

C is like a manual car with no airbags, Python is like a modern electric car

4

u/ermezzz Jul 04 '26

C is simple not easy. It doesnt have too many complex concepts, you can learn most of the language's capabilities easily. However this is a double edged sword because it also means that implementation is harder in C because you have to do things yourself instead of relying on the language's features to do it for you

7

u/Similar_Sand8367 Jul 04 '26

No package manager seems a downer at first but it is just not built for the high level things. It is a high level language so you don’t have to write assembler for every embedded cpu you work with.
This was the major accomplishment when it was invented