C language for system programming

The first textbook contributed to the popularity of C
This became successful thanks to the new freedom of programmers. Its disadvantage is the difficulty of debugging programs. It produces fast programs and a wide collection of APIs is available. It remains the best programming tool close to hardware and is used even for applications. See Why SQLite coded in C, for example. Other programs encoded in C: Linux, games Doom, Quake and SimCity, Apache, NGINX, PHP, JVM, Git...
The C language was developed from 1969 to 1972 by Dennis Ritchie for programming the Unix operating system. His goal was to be mobile. See Developing the C language for history.
The language textbook by Dennis Ritchie and Brian Kernigan is considered one of the best ever written .
It sounds quite rustic compared to modern languages, but by the 70s, as an alternative to Basic, it was extremely developed. Calling the function by line number or with variable names limited to two characters in the basic version of Microsoft AppleSoft made programming very laborious. Even Pascal, with his weight and tension, seemed less interesting than S.
This may always be a better solution than C++ for system programming, this is in any case the opinion of Linux Torvald, who decided to use this language for the very widespread Git software.
But this judgment (in 2007) can be dated to the fact that since C++ has undergone several changes and improvements, including with the 11th version. For critical system applications, however, C++ remains too complex and uncertain.
To fill the uncertainty of the C language, Microsoft created Checked C, an extension that tests memory problems in the program .
What you need to know about History C
Dennis Ritchie and his colleague Ken Thompson developed the language on a Teletype 33 type terminal, as shown in the photo below .
Dennis Ritchie (standing) and Ken Thomson at Bell Labs at Teletype Terminal 33
To imagine what programming looked like in such conditions, we will watch this video from the terminal in action... Then we have a better understanding of the syntax of the language made to preserve the strike, and where the = sign is chosen for assignment and = = for comparison, because assignment is more common than comparison! Here's the keyboard you saw up close...
Ritchie had to be creative in identifying the language to reduce the number of strokes, for example by using the++ increment operator. Other constructs are much more questionable, such as nested assignment in a comparative test.
In addition, the influence of the keyboard concerns both the source code of the compiler and the programs it recognizes. On the other hand, a modern language can be simplified at the cost of a more complex compiler. Keyboards have changed well, but intricate C designs remain in many other languages, including C++, Java, C # from Microsoft, and the very recent Go and Dart from Google and Swift.
Language where everything is an expression
Program C consists of a set of functions that return a value or not, and global variables. Everything can be evaluated as an expression, and this is not necessarily a security advantage.
Functions and variables have a prototype in the header file for sharing the source file.
The programmer must manage the memory himself, using pointers and functions to allocate or free memory blocks.
It is carried with some limitations: for example, additional types of variables depend on the compiler.
The 2011 ISO C11 standard adds new features to the C language: multithreading, Unicode, lambda functions, structures, and anonymous nested conjunctions.
Data structures
:Scalars: int, long, char, char *.
struct allows you to create an object type that is formed from several variables and is a harbinger of objects.
union allows you to give multiple variable identifiers and is used mainly with constructs.
typedef to define new data types.
Control structures
:- if... else
- switch... case... default
- while
- for
- before... while
- break, continue, return
- Gotha
Symbols
://and/* */comments.
& | & | | logical operators.
# directive for the preprocessor.
Composite symbols perform two operations on one variable. For example, a + = b adds b to a and then assigns the result to a.
Buckle
:while(x < y)
{
... instructions ...
}
Function definition
:int nom(char *x, int y)
{
... instructions ...
return(z);
}
Sample code
Show string characters in C.
char *s = "demo";
int l = strlen(s);
for(int i = 0; i < l; i++)
{
char c = s[i];
printf("%c\n", c);
}
See also
- LLVM. The compiler is optimized for C.
- C++. Object-oriented version C
- No, Mack. Compilation of project C without macephile.
C Sites and Tools
- Introduction to C. First course in C (English).
- Kling. Almost complete interpreter of C and C++.
- Tiny C Compiler. Compiles and executes C (Win/Linux) programs directly.
- C to C++. Converts a project from C to C++ .
- CheckC. Microsoft extension to add security to the language.
- Legacy-cc. The first C compiler, directed by Dennis Ritchie, is for the curious.
- Cello. An extension to add dynamic lists, objects, to avoid long C++ runtimes.
- Libmill. Extension to add corutins to C, like Go.