Everything you need to know to get started with C.

April 5, 2022 0 Comments

No language can claim to have had as much of an impact on computing as C since the beginning.

Like most programming languages, C was created out of dissatisfaction with existing programming languages. Back in 1969 – when the idea of ​​developing an operating system using a high-level programming language was still fancy – Dennis Rich B. began to realize the flaws in the programming language as he worked to re-code the Unix operating system into a new architecture. In high-level language. B was designed for a different computer generation – by Ken Thomson, who also contributed to C. The language was word-addressed instead of byte-address and lacked floating point support. Since the early colonialists of the digital age were not spoiled for choice like us today, they decided to create a programming language that was more suited to their needs.

Thus C was used in early 1972-1973, but before any serious attempt was made to standardize it, it was C, and would seem strange to today’s C developers. After the publication of The Sea Programming Language by Brian Carnighan and Dennis Rich in 1989, C finally got a widely available manual for its syntax. The first ‘official’ C standard approved by ANSI was published in 1989 and is still available on popular C compilers such as GCC C compilers. This language version is so popular that it is still the default syntax of the current (4.9) version of GCC. It is commonly referred to as C89 or C90. Since then C has undergone two major revisions, once in 1999 (known as C99), and again in 2011 (known as C11). GCC’s upcoming 5.0 release will eventually take the latest C11 version of C as the default.
How old it is, it is a testament to the design of the language and the skill of its designers that it is still relevant today.

Learn C tutorial

Dennis Rich (Permanent) and Ken Thomson working on the first computer for which they designed C (PDP-11).

Significance

It is difficult to overstate the significance of C in today’s computing landscape. Almost every popular programming language used today is inspired by rules set by JavaScript, Java, C #, PHP, Objective-C, and even Python-C. Although compared to inspired languages, C is significantly lower. C significantly improves the readability, maintainability, and ease-of-development of code compared to assembly, and is significantly more portable despite giving developers almost as much power as assemblies. C gives developers low-level access to machine hardware, with minimal abstraction in C, and allows developers to work directly with raw memory locations, including pointers. As you can imagine, this makes it the perfect candidate for system programming. A few other languages ​​are suitable, or highly used, for writing low-level code, such as operating system kernels or device drivers. One only has to look at the three main operating system families to see the evidence. The Linux kernel, the OSX kernel (Mac / Darwin) and the Windows (NT) kernel are mostly written in C, in which some assemblies are thrown. In fact, when one encounters a kernel that is not written in C, it is often a point to be noted.

Another area where C has a significant market share is in programming embedded systems. Low-level systems such as those that control various systems in the car, handle fuel / air mixture from ABS, etc. Since these systems are mission critical, and you don’t literally want a blue screen of death, the C version used in such systems is often a limited one. After all, if they detect a bug later, you can’t really patch your car with Car 1.0.1! It is also unbelievable that C is the language where interpreters of popular languages ​​like Python, PHP, Ruby and Luar are written. The deeper you go into computer programming, the more likely you are to get a lot of C’s. Almost every electronic device you touch, which has some kind of embedded microcontroller or microprocessor, runs at least some code that was once stored. In a .c file.

Learn C tutorial

Whether it’s a hobby project or a mission critical code running on an embedded device, it was probably written in C.

Oh world

#include <stdio.h>

int main(void) {

 
printf(“Hello, world!\n”);

  return 0;

}

Hello World is probably one of the easiest programs you can write in any language, and C is probably one of the more verbs. If you want something that compiles – with caution – and “hello, world!” While on screen, you can even get away with the following (including some compilers):

main() { 

  printf(“Hello, world!\n”); 

}

Arrange

void insertion_sort(int *arr, const size_t arr_len) {

    for (size_t i = 1; i < arr_len; i++) {

        int
elem = arr[i];

        size_t j = i;

        for (; j > 0 && elem < arr[j - 1]; j--) {

            arr[j] = arr[j - 1];

        }

        arr[j] =
elem;

    }

}

Sorting the inserts in C is not exactly complicated. In the example above we have new syntax which allows us to define variables because they are not used at the beginning of the function. It has been supported since C99.

Tools and Learning Resources

Another notable advantage of the C age is that there are plenty of tutorials, books, videos and the like available for C and many of them are absolutely free.

Dozens of compilers and IDEs are available for C, mostly free if not open source. However, the most important are — at least for desktop OS — Microsoft’s Visual C ++ compiler, GNU compiler collection (GCC), and the new Clang. Klang’s goal is to replace drop-ins for GCC, and features a similar interface. It is gaining popularity, and is now preferred by many BSDs and Apple – which is surprising because they are its early developers. If you use Windows, you have several options. Microsoft’s C / C ++ compilers are first shipped with the Windows SDK and with their Visual Studio IDE. The SDK is free, and a free version of Visual Studio IDE is available, and has recently expanded its feature-set a bit. If you want to develop fully for Windows, use Windows-specific features, or write extensions for parts of Windows, you’ll need it. Even otherwise, part of a well-developed software feature is the ability to be compiled by different vendors under multiple different compilers.

Learn C tutorial

Microsoft’s new Visual Studio Community Edition brings the free version of IDE closer to the paid offer.

Development tools in OSX are available with the SDK, and can be installed from the OSX DVD, or downloaded through the Mac App Store. This includes the XCode IDE. If you use Linux, chances are that the development tools and basic libraries for C are already installed, if not, it must be found in your Distro’s repository and only a command or two away. Also, if you use Linux you should probably know how to get it out of here! Another good IDE for C and C ++ is QtCretor by Digia. This is part of the Qt project, but you don’t have to use Qt yourself. After all, it’s free, open source and cross-platform.

Learn C tutorial

XCode is Apple’s free IDE for creating OSX and iOS apps.

If you use Linux / OSX, C documentation is basically created on your operating system! Documentation for any function is just a command away. Linux (and Unix and OSX) include ‘man’ or manual commands that can be called to the command line to open documentation on any subject. Many people are familiar with the command to use the command line program instructions, but it works equally well for the C function! Try it, if you are running a * nix OS, type ‘man printf’ and find an instant access guide for that function in C. Most of the C libraries you install will also have a documentation package installed, so it will work for any of your development libraries. Installed.

Learn C tutorial

QtCreator has great debugger integration as well as support for targeting Android.

Learn C tutorial

Manual that comes with most Linux software Is An invaluable resource of knowledge.

If you use Windows, or otherwise prefer to view this information in a GUI, you can use ‘man’ in your favorite search engine. ‘Try searching, and you’ll probably find one of the many online man-page repositories. . Although it will be less useful for Windows users.
Even though you’re already accessing your browser, there’s no end to the good learning resources for C. Just a search will reveal great start-up resources, so instead of repeating them here, we’ll share a three-point resource that teaches something interesting.

Create your own kernel module:
If you ever want to get into the realm of low-level programming, to create your own driver for the Linux kernel, here is a guide that will help you. Instead of going deeper, this tutorial demonstrates a very simple kernel module that simply creates a / dev / reverse device in Linux that reverses the word order of the strings sent to it. It’s up to you where to get it.

Learn about memory allocators, perhaps your own:
Believe it or not, someone actually has to code the bits of software that actually allocates, delocks, and keeps track of the memory of the variables you use in your programs. Since the creation and destruction of variables is very common in any software, speeding up this process can have a big impact on software performance, especially if the way you use variables is special, for example if you are creating a game. This article and this one will give an overview of this bit of software.

Add a new feature by changing Python’s code:
If you’ve ever wondered how features of actual code in a programming language map compiler or interpreter, this article is what you’re looking for. It was written by one of the original Python contributors, and takes you by changing its C code and adding a new statement to the Python syntax.

Visit here for tutorials on the other 15 hot programming languages.

Leave a Reply

Your email address will not be published.