Seriously, I don't use scanf that much in C. Most of the times, it doesn't do exactly what I want, or there is a more specialized alternative (ex: strtol). Also, generally, %s is bad, even the "safe" variant. For sscanf, it makes a copy, which is inefficient (if you are writing C, you want efficient code, right?) and you have to know the size in advance, and usually, you don't.
Most of my string manipulation in C involves loops, pointers and a lot of in-place manipulation. It is tedious compared to other languages but it is very efficient, the reason I picked C in the first place.
And C has libraries too, to be fair. So if you prefer the "choose between 25 competing libraries that all provide the desired functionality but half of them are deprecated or don't work" workflow a lot of people are used to from C++ or whatever you can do that. Lots of people use libraries in C. In fact, as you might be aware, your OS's package manager doubles as the C language's third-party package manager. There has been plenty of "already-written C code," because it's a language that has been ubiquitous in computing for fifty years.
I'm not sure where these same tired critiques bubble up from but I see them constantly and they don't make sense. There are a number of entirely valid and damning critiques to be made of the C ecosystem but "there aren't any libraries written in C" and "oh, so you say C is simple, huh? Have you tried using it?!" aren't among them.
You're not going to be a 20 year veteran C developer and then suddenly just today learn about some obscure built-in, and that's what is meant by "simple" here, and that's a good thing.
But you could suddenly learn about a new library feature that performs the same function as another language's builtin, which is for all practical purposes an equivalent experience. In both cases you see an unfamiliar string of characters in someone else's code, and then look up what it does.
About 30 years ago.
I learned C as a first year undergrad.
C definitely has many flaws, but I wouldn't say complexity is one of them. I wulld rather say it's too simple and one has to add the complexity all by themselves :D
So unless you actually DO teach then don't assume :)
I've even been a teaching assistant for the very first programming course students take, so I have taught C to first year undergrads!
If you need to do lots of string processing, C is simply not the right language.
Thankfully one isn't forced to only learn a single programming language in life ;)
Asset files, config files, shaders, obj files, CSV, XML, JSON, etc... it's not uncommon. Read the asset loading code in the posted game.
For a language that doesn't even know what a "string" is, C applications tend to involve a lot of string parsing.
You could have thrown in a bunch of functions from string(3), but even then... C string handling isn't great by any means, but it isn't vast or complicated either.
It's small and easy to grasp the entire thing though, unlike most other more modern high level languages.
That said, it's not entirely clear that matters too much. Almost any non-toy C project is going to be bringing in libraries outside libc, so you still need to go off and learn those if you want to work on a project. Doesn't really matter whether they're in the base language or not.
> It's small and easy to grasp the entire thing though, unlike most other more modern high level languages.
So ready for the question?
Oh, well it didn't address what I wrote.
> So ready for the question?
Doesn't address what I wrote.
Whatever
You would have a point about knowing exactly every single corner case of the language. I don't think that's easy even for C. Fortunately I didn't claim it was either.
> grasp
You said "It's small and easy to grasp the entire thing though, unlike most other more modern high level languages."
The entire thing doesn't include corners? And you entered the conversation in support of someone that literally said "every corner, nook and cranny"! If you were making a much weaker claim, it's on you to make that clear. Instead of this petty "doesn't address what I wrote" garbage.
On top of that, being able to suss out what is undefined behavior is in fact quite important for proper use of C. I wish it was a super rare corner case but it's not.
> The entire thing doesn't include corners?
It does.
> And you entered the conversation in support of someone that literally said "every corner, nook and cranny"!
So reply to that.
> If you were making a much weaker claim, it's on you to make that clear.
I did. You just didn't read what I wrote.
> Instead of this petty "doesn't address what I wrote" garbage.
Garbage. Ironic.
> On top of that, being able to suss out what is undefined behavior is in fact quite important for proper use of C. I wish it was a super rare corner case but it's not.
Sure. Doesn't change the fact your question was stupid and didn't address what I wrote.