Evolution of C language features

Reading time: · 3 min

C programming language was first developed in the 1970s. In 50 years of evolution, it has experienced many significant changes. In this article, you will get a chance to see how C language evolved. You will learn about specific mutations of various features, too. This will enrich your understanding of this intricate low-level language.

So, let's jump right in.

5+ mutated features of C programming language

1. Mutated function declaration in C

ISO committee has changed over the years function declarations in C programming language. Function declarations originally did not contain type declarations of parameters. Types of parameters needed to be declared after function declaration. You can see in the third example below.

Example 1: Main function declaration in legacy C

main ()
int argc;
const char** argv;
{
}
					

Example 2: Main function declaration in modern C language

int main ( int argc, const char ** argv )
{
}
					

2. Mutated comments in C

Even comments experienced additions. A single-line comments looked verbose 50 years ago. Since C programming language only defined multi-line comments. Hence to write a single-line comment C programmers had to use multi-line comments.

Example 3: Original C comment syntax

/* a single-line of comment in legacy C */

Example 4: Added C comment syntax

// a single-line of comment in modern-day C

3. Mutated variable declaration in C

Positioning of variable declaration in functions changed, too, in C programming language. The legacy C programming language required to define variables at the top of every function. ISO committee changed this with newer version of C programming language.

Today, C programmers can declare variables anywhere within their functions. Keep in mind, that even variables inside for loops needed to be declared beforehand.

Example 5: A for loop in legacy C

int main ()
{
    
int i;
    
for (i = 0; i < 10; i++){}
    
return 0;
}
					

4. Mutated structs in C

Some of the parts of the legacy C programming language are still used today. One example of this could be the original struct, enum and union data types. In the legacy C, struct type name needed to be decorated with the struct keyword, since the keyword typedef was only introduced in later C language versions. This is still a common practice, for example, in Linux kernel.

Example 6: A struct in legacy C

struct node {};
void main ()
{
    
struct node first;
}
					

Example 7: A struct in modern C

typedef struct node {} node;
void main ()
{
    
node first;
}
					

5. Mutated primitive types in C

In the C99 version of C programming language, a new header stdint.h was introduced. This header defines more nuanced data types of specific sizes. It offers optimization possibilities for counters, too.

Example 8: Newly introduced size specific data types in C

uint8_t    uint16_t    uint32_t    uint64_t
int8_t    int16_t    int32_t    int64_t
uint_least8_t    int_least8_t
uint_fast8_t    int_fast8_t

Summary

In summary, C programming language has evolved over the course of 50 years. As of today, comments, data types, function, as well as, variable declarations are different. ISO committee is still active as of 2022. Thus, we can still expect positive mutations of this intricate programming language.