DEV Community

Discussion on: Learning C as a first language

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

A couple of nit picks:

because it's hard because of pointers, address, DMA, no OOP, no abstractions etc

Pointers are only hard if you're not paying attention and didn't have them explained properly. If you properly explain the concept of indirection first (which most people will have no issue understanding, as the concept is baked into most natural languages), pointers will often come naturally as a logical extension when explained.

DMA is not a thing in most C coding unless you're doing OS-level code (like Linux kernel code) or tight embedded stuff that doesn't involve an OS. In fact, I've done a decent (not huge) amount of work in C and never touched DMA at all. It's more an assembly thing in many cases anyway.

OOP and abstractions are absolutely possible in C, that's part of what pointers (especially function pointers) and structs are for (your object is a struct, your methods are function pointers, and you use a constructor method just like you would in many languages). Check the Linux kernel source code if you don't believe me, they're more object-oriented in some places than a lot of C++ code I've seen.

Collapse
 
delta456 profile image
Swastik Baranwal

I agree with you. I meant that the standard library does not provide with abstraction like modern languages give. You can even in OOP in ASM as well if you see it that way.