Ask HN: Is C Really That “Difficult”?
Seems like it is just a combination of bad designs that make doing simple things tedious and not being smart.
Any examples that really show the difficulties?
Seems like it is just a combination of bad designs that make doing simple things tedious and not being smart.
Any examples that really show the difficulties?
If you are finding C++ difficult, perhaps you could learn C first.
C came out in the mid-70s, C++ about a decade later, and both still get used to write lots of new code.
Some programmers find C and C++ difficult to learn and master, others don't. That depends on the programmer, not the language. Some people struggle with Python and Javascript too.
Once you get past that (really get past it, not just fumble through it) C has a large number of foot guns available.
It's not a difficult language (it only has a few "instructions" if you will) but it is difficult to avoid all the possible mistakes.
C++ is an entirely separate language that happens to have some similarities.
https://beej.us/guide/bgc/pdf/bgc_usl_c_1.pdf is a good introduction to C.
Understanding how CPUs and memory work requires the programmer to put in more effort learning the fundamentals at a lower level of abstraction. That creates a filter -- some people won't get through that and will forever find pointers, and therefore C, confusing and mysterious. I could say the same thing about SQL. If you don't actually understand the relational model and how databases work you stay at the surface level, never really sure what goes on inside.
The best intro to C remains the classic The C Programming Language by Kernighan and Ritchie, called K&R for short. I would recommend Adam Osborne's books on microcomputers to understand processors and memory but they went out of print decades ago.
I feel that we work better with C because of that. In fact, C has been called 'high level Assembly Language' by somebody in the past.
C is not difficult. C++ is difficult because of its use of overloading (IMHO) and it seems quite messy. In C, the frugal language, what you see is what you get.