Getting Started with the C Language

Getting Started with the C Language

History of the C language

C was developed by Dennis Ritchie in 1972 at AT&T's Bell Labs, USA. The C language was the successor of the B language.

Why did Dennis Ritchie develop the C language?

The C programming language was created to address issues with earlier languages like B, BCPL, etc. The C language was used to rewrite the Unix kernel, and after that, C became popular.

Why do we learn C as our first programming language?

The significant reasons are:

  • C covers the basic features of all programming languages.

  • C enables us to be aware of memory management and to build programming skills.

  • C is the most popular programming language for hardware-dependent programming.

Some facts about the C language

  • Oracle and MySQL are written in C.

  • The core libraries of Android are written in C.

  • Almost every device driver is written in C.

  • The major part of the web browser is written in C.

  • C is the world's most popular programming language.

  • C is the mother of most programming languages like C++, Java, etc.

Let's compare C with natural language for easy understanding

There are alphabets in any natural language like English, Hindi, Punjabi, etc., with English having 26 alphabets. If we know the alphabet, then only we can make words, and if we know how to make words, then only we can make sentences. We also follow grammatical rules to write better.

Now in C and any other programming language, these things are called:

  • Alphabets in the programming language are known as "symbols." There are not only 28 symbols, as in English. There are so many symbols in programming languages.

  • Words in the programming language are known as "tokens." In this blog, we discuss the three types of tokens in detail.

  • Sentences in the programming language are known as "instructions." There are four types of instructions, which we will discuss in the coming blogs.

  • Grammatical rules in the programming language are known as "syntax." When we write instructions, we follow the syntax of a specific language.

What are Tokens?

Tokens are meaningful words for the compiler, which means the compiler knows the meaning (definition) of those words.

We discuss only three types of tokens now:

  1. Constants.

  2. Variables.

  3. Keywords.

What are the constants?

In C, constants mean data or information. As far as we know, any software that always manages data—for instance, a to-do list on our computers, phones, etc.—contains our daily tasks as information. Based on what type of data is managed by our software, we divide constants into two categories:

Two categories are

  1. Primary constants: Primary constants are further divided into integer constants, character constants, and real constants.

  2. Secondary constants: Secondary constants are further divided into array, string, pointer, union, structure, and enumerator.

What are variables?

Variables are the containers that are used to store data. Variables also have an address and a name.

That means variables are the name of the memory location where we store data. This may be difficult to understand; do not worry; we discuss this in the next blog, "Data-types and Variable Declaration."

Note: We declare variables using data-type declaration instructions; only then is the compiler able to understand the meaning of the variables.

Why do we use variables?

If we store data without using variables, then we cannot use this data again in our program, but if we use variables to store this data, then we can use this data in our program again and again by using the variable name and address.

What are keywords?

Keywords are predefined words whose meaning is already known by the compiler; there is no need for any type of instruction to declare them. There are 44 keywords in the C language.

Note: We give variable names. So, remember, a variable name cannot be the same as a keyword name.

Conclusion:

You covered the History and tokens of C in this blog. You can now research more about it online. If you'd like, you can connect with me on Twitter.

Gratitude for reading.