Starting with C programming language

Before we start discussing about C as a programming language, we must be clear about the term programming language itself. Only then, we will be able to appreciate C as a programming language.

As the name suggests, programming language is a language. A language that computer understands, and that is used to interact with the heart of the computer. Obviously this language has to be understood by programmers as well, so that the interaction is understood by both the parties. In other words, through a programming language, you are giving instructions to the computer on the tasks it has to perform.


How programming language enables you to interact with computer is a bigger question. A computer does not directly understands the programming language, it understand only electrical signals (high voltage and low voltage, or in simpler terms 0 and 1, also called machine language). Although humans can interpret this coded language, but it is very inefficient and error prone. So we need a translator that converts this series of 0s and 1s into human readable version, the software that does this job is called a compiler or an interpreter based upon the method of translation used. C and other high level languages such as Java, Visual Basic etc are compiled languages, meaning that compiler is the heart of these languages. There are many compilers available for each programming language, for example C has turboC and GCC as compilers. You can understand these as products of different companies, which differ in their characteristics, services and ease of use they provide. But their basic task is to convert C code into computer under-standable 0s and 1s.


For our journey of talking about the basics of C, we will be using an online compiler programiz.com. I personally prefer online compilers because of the obvious benefits they provide; for example, you can access your code from multiple devices. You can use any compiler you wish, or you can use any other compiler as well.


Most of the online compilers provide you with an option to have a pre written code segment, which you can use as a start point for your program. For instance, onlinegdb.com compiler gets you started with a default “Hello world!” printing program. Which you can modify as per your need. Typically, the first program anyone learns to execute in any programming language is to print hello world. We will also use the same to learn basic programming constructs of C language.


Program to print “hello world” in C language


If you see the screenshot above, a typical C program has following constructs:


1. #include section: This section is used to include pre compiled C libraries to your code. These are already available C programs in machine language, to perform specific tasks. For example, studio.h enables you to get input from standard terminal and output to standard terminal as well.


2. Main() section: This is where the execution of a C program starts. Whatever your programs does has to be written directly or indirectly into this section (we will discuss more on this later). For instance, the statement printf is to display on screen, whatever is written within the double quotes. So, when this program executes, “Hello world” will be displayed on the screen.


So that concludes our first post, I hope we will have fun time learning C together. I am pasting below the video link from my YouTube channel in Hindi. You can go through it, if you wish to.



Welcome to glittering code

Hi there, I am a software professional with over a decade of industry experience. I am here to share my knowledge and experience with all of you, and in the process, learn a lot of things myself. As the saying goes, a good code is all that glitters. Let’s begin our journey to make our codes glitter.