Content health: prewriting stage
This chapter is not yet finished. To speed up the progress, help us fix it at GitHub.

Introduction to C programming

Why should you know C programming language?

  • Many other programming languages are written in C;
  • Many modern languages are influenced by C;
  • PHP language and PHP extensions are written in C;
  • C helps you think like a computer;
  • Many software development tools are written in C and C++;

What is C?

C is a fundamental general purpose, widely used, compiled programming language designed by Dennis Ritchie at Bell Labs. It can be compiled to a number of platforms. It includes small number of keywords and provides large number of mathematical operators. It can be learned very quickly however to dive in more depth and to fully understand it, a lot of programming practice is required.

C vs C++

A common ambiguity when starting with C programming is whether to start directly with C or maybe start with C++ or even something else, like objective C.

At the time of this writing, when first encountering the C waters it is probably better for many to start with C instead of C++.

C is also simpler to grasp, includes less core syntax features, and knowing it will help you further understand C++ in case you will want to dive deeper.

According to the C++ creator, Bjarne Stroustrup, C and C++ should be a single language with C being a subset of C++. However, due to the evolution history they are now two different languages.

C++ can run C code but manytimes a lot of refactoring is needed.

Few key differences between C and C++:

  • C++ has matrices. If you want to create a matrix in C, you'll need to create a bunch of arrays.
  • C++ offers also object oriented paradigm.
  • C++ offers simpler, a more human approach to software development, where C is by many considered closer to hardware and operates on a lower level. More expertise and thinking like computer is needed with C language.

C language has started before the C++ and now has a huge install base and a lot of that software could be rewritten in C++ for reasons of making it more modern, attractive to new comers and extendable with features, that C++ is offering. However, when putting time, cost, and historic evolution into the perspective, many project maintainers will not migrate to a language like C++ for a long time, probably never. Therefore, knowing the C language is inevitable. When starting a new project, thinking of C++ and other options is definitely the way to go.

Found a typo? Something wrong with this content?

Just fork and edit it.

Content of this work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. Code snippets in examples are published under the CC0 1.0 Universal (CC0 1.0). Thanks to all contributors.