C programming
April 23, 2020

C programming | Beyond basis

Programming in C is something that is often considered old-fashioned or complicated. The C programming language was created to be used in Unix systems as a high-level language. It's been almost fifty years since the creation of the Unix operating system, and the C programming language still plays a rock-solid role nowadays.

Programming software is not far away from programming operating systems and embedded devices. Not all software has to be mobile-first or web-ready.

Why C?

Apart from operating system kernels, code written in C can be found in database servers, embedded systems, cars, computational engines and real-time systems.

— C is an easy to learn programming language. Compared to other programming languages, it expects the programmer to take care of details like variable types or memory allocation but it's not that hard. We're working inside a machine that understands data that flows between memory directions, yet we're not asked to program in hex or binary code.

It's true that it takes longer than other high-level languages to get a finished program. But by programming in C you are going to learn a lot about how software communicates with the machine to achieve results.

What C offers

This are some -huge- advantages of developing software with C:

  • C is simple (compared to C++, Java) yet powerful.
  • No need to install any interpreter, virtual machine or library to start working with it.
  • No need to install any specific IDE, a text editor is enough.
  • Compilers are really easy to use and there is at least one C compiler for almost every existent architecture.
  • You can bind scripting languages such as Lua or Python to your program.
  • Direct access to memory. If done correctly, programs can be really memory efficient.
  • Cross-platform is mostly ensured (depends if the software project in the making uses specific libraries like a GUI and which one we use in that case).

Wait, there is C++

C++ it's trendy, considered the go-to language to do heavy object oriented programming software projects.

— C++ is a superset of C, most of the people that program in C++ are using C programming features 99% of the time, and 1% using C++ features. Most software projects don't need object oriented programming.

— C is completely capable of making a good heavy-duty software, without over complicating methods. Take the Blender 3D authoring tool as an example.

What to expect

If you're new to programming in C, the basis can be learnt with the K&R C Programming language book which was written by the language creators.

Through these articles we're going to explore specific functionality and workflows in C that comes to a programmer's mind once the basis have been acquired. I'm not a PhD. nor a recognized teacher of any famous university, but I hope you can find the content useful and interesting (:

Here's an index for the content of the articles:

  1. Working with headers
  2. Working with memory
  3. Working with pointers and arrays
  4. Working with files
  5. Working with files II
  6. Threading basis
  7. Minimal GUI applications